summaryrefslogtreecommitdiffstats
path: root/src/corelib/io
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/io')
-rw-r--r--src/corelib/io/io.pri37
-rw-r--r--src/corelib/io/qabstractfileengine_p.h1
-rw-r--r--src/corelib/io/qdatastream.cpp1
-rw-r--r--src/corelib/io/qdatastream.h5
-rw-r--r--src/corelib/io/qdatastream_p.h1
-rw-r--r--src/corelib/io/qdataurl_p.h1
-rw-r--r--src/corelib/io/qdebug_p.h1
-rw-r--r--src/corelib/io/qdir.cpp10
-rw-r--r--src/corelib/io/qfileselector.cpp13
-rw-r--r--src/corelib/io/qfileselector_p.h2
-rw-r--r--src/corelib/io/qfilesystemengine.cpp2
-rw-r--r--src/corelib/io/qfilesystemengine_unix.cpp7
-rw-r--r--src/corelib/io/qfilesystemengine_win.cpp260
-rw-r--r--src/corelib/io/qfilesystementry_p.h1
-rw-r--r--src/corelib/io/qfilesystemiterator_win.cpp5
-rw-r--r--src/corelib/io/qfilesystemmetadata_p.h9
-rw-r--r--src/corelib/io/qfilesystemwatcher.cpp4
-rw-r--r--src/corelib/io/qfilesystemwatcher_fsevents.mm8
-rw-r--r--src/corelib/io/qfilesystemwatcher_win.cpp10
-rw-r--r--src/corelib/io/qfsfileengine.cpp8
-rw-r--r--src/corelib/io/qfsfileengine_p.h9
-rw-r--r--src/corelib/io/qfsfileengine_win.cpp141
-rw-r--r--src/corelib/io/qiodevice.cpp33
-rw-r--r--src/corelib/io/qipaddress_p.h1
-rw-r--r--src/corelib/io/qlockfile_p.h1
-rw-r--r--src/corelib/io/qlockfile_unix.cpp4
-rw-r--r--src/corelib/io/qlockfile_win.cpp4
-rw-r--r--src/corelib/io/qloggingregistry_p.h1
-rw-r--r--src/corelib/io/qprocess.cpp14
-rw-r--r--src/corelib/io/qprocess_unix.cpp2
-rw-r--r--src/corelib/io/qprocess_win.cpp4
-rw-r--r--src/corelib/io/qprocess_wince.cpp308
-rw-r--r--src/corelib/io/qresource.cpp4
-rw-r--r--src/corelib/io/qsettings.cpp12
-rw-r--r--src/corelib/io/qsettings_mac.cpp30
-rw-r--r--src/corelib/io/qsettings_win.cpp8
-rw-r--r--src/corelib/io/qstandardpaths_mac.mm4
-rw-r--r--src/corelib/io/qstandardpaths_unix.cpp2
-rw-r--r--src/corelib/io/qstandardpaths_win.cpp42
-rw-r--r--src/corelib/io/qstorageinfo_p.h3
-rw-r--r--src/corelib/io/qtemporaryfile.cpp27
-rw-r--r--src/corelib/io/qtemporaryfile_p.h5
-rw-r--r--src/corelib/io/qtextstream.cpp2
-rw-r--r--src/corelib/io/qtextstream_p.h1
-rw-r--r--src/corelib/io/qtldurl_p.h1
-rw-r--r--src/corelib/io/qurl.cpp40
-rw-r--r--src/corelib/io/qurl.h16
-rw-r--r--src/corelib/io/qurl_mac.mm74
-rw-r--r--src/corelib/io/qurl_p.h1
-rw-r--r--src/corelib/io/qurltlds_p.h2
-rw-r--r--src/corelib/io/qwindowspipereader.cpp17
-rw-r--r--src/corelib/io/qwindowspipewriter.cpp5
-rw-r--r--src/corelib/io/qwindowspipewriter_p.h1
-rw-r--r--src/corelib/io/qwinoverlappedionotifier_p.h1
54 files changed, 218 insertions, 988 deletions
diff --git a/src/corelib/io/io.pri b/src/corelib/io/io.pri
index 1cb2909c2a..ab345e9aae 100644
--- a/src/corelib/io/io.pri
+++ b/src/corelib/io/io.pri
@@ -106,25 +106,21 @@ win32 {
SOURCES += io/qfilesystemiterator_win.cpp
!winrt {
- SOURCES += io/qsettings_win.cpp
- SOURCES += io/qstandardpaths_win.cpp
+ HEADERS += \
+ io/qwindowspipereader_p.h \
+ io/qwindowspipewriter_p.h \
+ io/qwinoverlappedionotifier_p.h
- wince* {
- SOURCES += io/qprocess_wince.cpp \
- io/qstorageinfo_stub.cpp
- } else {
- HEADERS += \
- io/qwinoverlappedionotifier_p.h \
- io/qwindowspipereader_p.h \
- io/qwindowspipewriter_p.h
- SOURCES += \
- io/qprocess_win.cpp \
- io/qwinoverlappedionotifier.cpp \
- io/qwindowspipereader.cpp \
- io/qwindowspipewriter.cpp \
- io/qstorageinfo_win.cpp
- LIBS += -lmpr
- }
+ SOURCES += \
+ io/qprocess_win.cpp \
+ io/qsettings_win.cpp \
+ io/qstandardpaths_win.cpp \
+ io/qstorageinfo_win.cpp \
+ io/qwindowspipereader.cpp \
+ io/qwindowspipewriter.cpp \
+ io/qwinoverlappedionotifier.cpp
+
+ LIBS += -lmpr
} else {
SOURCES += \
io/qstandardpaths_winrt.cpp \
@@ -139,7 +135,7 @@ win32 {
io/qprocess_unix.cpp \
io/qfilesystemiterator_unix.cpp
- !integrity {
+ !integrity:!tvos {
SOURCES += io/forkfd_qt.cpp
HEADERS += \
../3rdparty/forkfd/forkfd.h
@@ -147,7 +143,6 @@ win32 {
}
!nacl:mac: {
SOURCES += io/qsettings_mac.cpp
- OBJECTIVE_SOURCES += io/qurl_mac.mm
}
mac {
SOURCES += io/qstorageinfo_mac.cpp
@@ -156,7 +151,7 @@ win32 {
OBJECTIVE_SOURCES += io/qfilesystemwatcher_fsevents.mm
HEADERS += io/qfilesystemwatcher_fsevents_p.h
LIBS += -framework DiskArbitration -framework IOKit
- } else:ios {
+ } else {
LIBS += -framework MobileCoreServices
}
} else:android {
diff --git a/src/corelib/io/qabstractfileengine_p.h b/src/corelib/io/qabstractfileengine_p.h
index 0293184645..48b3dec324 100644
--- a/src/corelib/io/qabstractfileengine_p.h
+++ b/src/corelib/io/qabstractfileengine_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtCore/private/qglobal_p.h>
#include "QtCore/qfile.h"
#include "QtCore/qdir.h"
diff --git a/src/corelib/io/qdatastream.cpp b/src/corelib/io/qdatastream.cpp
index de1fc18cd0..b4eb98e062 100644
--- a/src/corelib/io/qdatastream.cpp
+++ b/src/corelib/io/qdatastream.cpp
@@ -556,6 +556,7 @@ void QDataStream::setByteOrder(ByteOrder bo)
\value Qt_5_5 Same as Qt_5_4
\value Qt_5_6 Version 17 (Qt 5.6)
\value Qt_5_7 Same as Qt_5_6
+ \value Qt_5_8 Same as Qt_5_6
\omitvalue Qt_DefaultCompiledVersion
\sa setVersion(), version()
diff --git a/src/corelib/io/qdatastream.h b/src/corelib/io/qdatastream.h
index 260dd519e3..5956f9ac40 100644
--- a/src/corelib/io/qdatastream.h
+++ b/src/corelib/io/qdatastream.h
@@ -91,10 +91,11 @@ public:
Qt_5_5 = Qt_5_4,
Qt_5_6 = 17,
Qt_5_7 = Qt_5_6,
-#if QT_VERSION >= 0x050800
+ Qt_5_8 = Qt_5_7,
+#if QT_VERSION >= 0x050900
#error Add the datastream version for this Qt version and update Qt_DefaultCompiledVersion
#endif
- Qt_DefaultCompiledVersion = Qt_5_7
+ Qt_DefaultCompiledVersion = Qt_5_8
};
enum ByteOrder {
diff --git a/src/corelib/io/qdatastream_p.h b/src/corelib/io/qdatastream_p.h
index 73f57e2d6c..3ca0ae840e 100644
--- a/src/corelib/io/qdatastream_p.h
+++ b/src/corelib/io/qdatastream_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtCore/private/qglobal_p.h>
#include <qdatastream.h>
QT_BEGIN_NAMESPACE
diff --git a/src/corelib/io/qdataurl_p.h b/src/corelib/io/qdataurl_p.h
index d2fa247b95..fd5c7df50b 100644
--- a/src/corelib/io/qdataurl_p.h
+++ b/src/corelib/io/qdataurl_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtCore/private/qglobal_p.h>
#include "QtCore/qurl.h"
#include "QtCore/qbytearray.h"
#include "QtCore/qstring.h"
diff --git a/src/corelib/io/qdebug_p.h b/src/corelib/io/qdebug_p.h
index ead86bbb6d..a1887655d2 100644
--- a/src/corelib/io/qdebug_p.h
+++ b/src/corelib/io/qdebug_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtCore/private/qglobal_p.h>
#include "QtCore/qdebug.h"
#include "QtCore/qmetaobject.h"
#include "QtCore/qflags.h"
diff --git a/src/corelib/io/qdir.cpp b/src/corelib/io/qdir.cpp
index f8fae711f2..91953ebf26 100644
--- a/src/corelib/io/qdir.cpp
+++ b/src/corelib/io/qdir.cpp
@@ -146,9 +146,11 @@ inline QStringList QDirPrivate::splitFilters(const QString &nameFilter, QChar se
{
if (sep.isNull())
sep = getFilterSepChar(nameFilter);
- QStringList ret = nameFilter.split(sep);
- for (int i = 0; i < ret.count(); ++i)
- ret[i] = ret[i].trimmed();
+ const QVector<QStringRef> split = nameFilter.splitRef(sep);
+ QStringList ret;
+ ret.reserve(split.size());
+ for (const auto &e : split)
+ ret.append(e.trimmed().toString());
return ret;
}
@@ -2187,7 +2189,7 @@ QString QDir::cleanPath(const QString &path)
name.replace(dir_separator, QLatin1Char('/'));
bool allowUncPaths = false;
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) //allow unc paths
+#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) //allow unc paths
allowUncPaths = true;
#endif
diff --git a/src/corelib/io/qfileselector.cpp b/src/corelib/io/qfileselector.cpp
index b2f4b6931f..920281cef7 100644
--- a/src/corelib/io/qfileselector.cpp
+++ b/src/corelib/io/qfileselector.cpp
@@ -55,8 +55,6 @@ QT_BEGIN_NAMESPACE
//Environment variable to allow tooling full control of file selectors
static const char env_override[] = "QT_NO_BUILTIN_SELECTORS";
-static const ushort selectorIndicator = '+';
-
Q_GLOBAL_STATIC(QFileSelectorSharedData, sharedData);
static QBasicMutex sharedDataMutex;
@@ -267,7 +265,7 @@ QUrl QFileSelector::select(const QUrl &filePath) const
return ret;
}
-static QString selectionHelper(const QString &path, const QString &fileName, const QStringList &selectors)
+QString QFileSelectorPrivate::selectionHelper(const QString &path, const QString &fileName, const QStringList &selectors, const QChar &indicator)
{
/* selectionHelper does a depth-first search of possible selected files. Because there is strict
selector ordering in the API, we can stop checking as soon as we find the file in a directory
@@ -276,12 +274,15 @@ static QString selectionHelper(const QString &path, const QString &fileName, con
Q_ASSERT(path.isEmpty() || path.endsWith(QLatin1Char('/')));
for (const QString &s : selectors) {
- QString prospectiveBase = path + QLatin1Char(selectorIndicator) + s + QLatin1Char('/');
+ QString prospectiveBase = path;
+ if (!indicator.isNull())
+ prospectiveBase += indicator;
+ prospectiveBase += s + QLatin1Char('/');
QStringList remainingSelectors = selectors;
remainingSelectors.removeAll(s);
if (!QDir(prospectiveBase).exists())
continue;
- QString prospectiveFile = selectionHelper(prospectiveBase, fileName, remainingSelectors);
+ QString prospectiveFile = selectionHelper(prospectiveBase, fileName, remainingSelectors, indicator);
if (!prospectiveFile.isEmpty())
return prospectiveFile;
}
@@ -369,7 +370,7 @@ QStringList QFileSelectorPrivate::platformSelectors()
#if defined(Q_OS_WIN)
// can't fall back to QSysInfo because we need both "winphone" and "winrt" for the Windows Phone case
ret << QStringLiteral("windows");
- ret << QSysInfo::kernelType(); // "wince" and "winnt"
+ ret << QSysInfo::kernelType(); // "winnt"
# if defined(Q_OS_WINRT)
ret << QStringLiteral("winrt");
# if defined(Q_OS_WINPHONE)
diff --git a/src/corelib/io/qfileselector_p.h b/src/corelib/io/qfileselector_p.h
index f93eb0ccb3..024d0b190d 100644
--- a/src/corelib/io/qfileselector_p.h
+++ b/src/corelib/io/qfileselector_p.h
@@ -70,6 +70,8 @@ public:
static void updateSelectors();
static QStringList platformSelectors();
static void addStatics(const QStringList &); //For loading GUI statics from other Qt modules
+ static QString selectionHelper(const QString &path, const QString &fileName,
+ const QStringList &selectors, const QChar &indicator = QLatin1Char('+'));
QFileSelectorPrivate();
QString select(const QString &filePath) const;
diff --git a/src/corelib/io/qfilesystemengine.cpp b/src/corelib/io/qfilesystemengine.cpp
index fd8f251ccb..febfdbb9d4 100644
--- a/src/corelib/io/qfilesystemengine.cpp
+++ b/src/corelib/io/qfilesystemengine.cpp
@@ -91,7 +91,7 @@ QString QFileSystemEngine::slowCanonicalized(const QString &path)
if (separatorPos != -1) {
if (fi.isDir() && !target.endsWith(slash))
target.append(slash);
- target.append(tmpPath.mid(separatorPos));
+ target.append(tmpPath.midRef(separatorPos));
}
tmpPath = QDir::cleanPath(target);
separatorPos = 0;
diff --git a/src/corelib/io/qfilesystemengine_unix.cpp b/src/corelib/io/qfilesystemengine_unix.cpp
index 75797e58da..6aaaa4c05a 100644
--- a/src/corelib/io/qfilesystemengine_unix.cpp
+++ b/src/corelib/io/qfilesystemengine_unix.cpp
@@ -61,7 +61,7 @@
#include <CoreServices/CoreServices.h>
#endif
-#ifdef Q_OS_IOS
+#if defined(QT_PLATFORM_UIKIT)
#include <MobileCoreServices/MobileCoreServices.h>
#endif
@@ -182,8 +182,9 @@ QFileSystemEntry QFileSystemEngine::getLinkTarget(const QFileSystemEntry &link,
#endif
if (!ret.startsWith(QLatin1Char('/'))) {
- if (link.filePath().startsWith(QLatin1Char('/'))) {
- ret.prepend(link.filePath().left(link.filePath().lastIndexOf(QLatin1Char('/')))
+ const QString linkFilePath = link.filePath();
+ if (linkFilePath.startsWith(QLatin1Char('/'))) {
+ ret.prepend(linkFilePath.leftRef(linkFilePath.lastIndexOf(QLatin1Char('/')))
+ QLatin1Char('/'));
} else {
ret.prepend(QDir::currentPath() + QLatin1Char('/'));
diff --git a/src/corelib/io/qfilesystemengine_win.cpp b/src/corelib/io/qfilesystemengine_win.cpp
index 85c795fadd..abf346a717 100644
--- a/src/corelib/io/qfilesystemengine_win.cpp
+++ b/src/corelib/io/qfilesystemengine_win.cpp
@@ -52,14 +52,11 @@
#include "qvarlengtharray.h"
#include "qdatetime.h"
#include "qt_windows.h"
+#include "qvector.h"
-#if !defined(Q_OS_WINCE)
-# include <sys/types.h>
-# include <direct.h>
-# include <winioctl.h>
-#else
-# include <types.h>
-#endif
+#include <sys/types.h>
+#include <direct.h>
+#include <winioctl.h>
#include <objbase.h>
#ifndef Q_OS_WINRT
# include <shlobj.h>
@@ -116,8 +113,7 @@ typedef INT_PTR intptr_t;
# define INVALID_FILE_ATTRIBUTES (DWORD (-1))
#endif
-#if !defined(Q_OS_WINCE)
-# if !defined(REPARSE_DATA_BUFFER_HEADER_SIZE)
+#if !defined(REPARSE_DATA_BUFFER_HEADER_SIZE)
typedef struct _REPARSE_DATA_BUFFER {
ULONG ReparseTag;
USHORT ReparseDataLength;
@@ -143,32 +139,31 @@ typedef struct _REPARSE_DATA_BUFFER {
} GenericReparseBuffer;
};
} REPARSE_DATA_BUFFER, *PREPARSE_DATA_BUFFER;
-# define REPARSE_DATA_BUFFER_HEADER_SIZE FIELD_OFFSET(REPARSE_DATA_BUFFER, GenericReparseBuffer)
-# endif // !defined(REPARSE_DATA_BUFFER_HEADER_SIZE)
+# define REPARSE_DATA_BUFFER_HEADER_SIZE FIELD_OFFSET(REPARSE_DATA_BUFFER, GenericReparseBuffer)
+#endif // !defined(REPARSE_DATA_BUFFER_HEADER_SIZE)
-# ifndef MAXIMUM_REPARSE_DATA_BUFFER_SIZE
-# define MAXIMUM_REPARSE_DATA_BUFFER_SIZE 16384
-# endif
-# ifndef IO_REPARSE_TAG_SYMLINK
-# define IO_REPARSE_TAG_SYMLINK (0xA000000CL)
-# endif
-# ifndef FSCTL_GET_REPARSE_POINT
-# define FSCTL_GET_REPARSE_POINT CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 42, METHOD_BUFFERED, FILE_ANY_ACCESS)
-# endif
-#endif // !defined(Q_OS_WINCE)
+#ifndef MAXIMUM_REPARSE_DATA_BUFFER_SIZE
+# define MAXIMUM_REPARSE_DATA_BUFFER_SIZE 16384
+#endif
+#ifndef IO_REPARSE_TAG_SYMLINK
+# define IO_REPARSE_TAG_SYMLINK (0xA000000CL)
+#endif
+#ifndef FSCTL_GET_REPARSE_POINT
+# define FSCTL_GET_REPARSE_POINT CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 42, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#endif
QT_BEGIN_NAMESPACE
Q_CORE_EXPORT int qt_ntfs_permission_lookup = 0;
-#if defined(Q_OS_WINCE) || defined(Q_OS_WINRT)
+#if defined(Q_OS_WINRT)
static QString qfsPrivateCurrentDir = QLatin1String("");
-// As none of the functions we try to resolve do exist on Windows CE
+// As none of the functions we try to resolve do exist on WinRT
// we use QT_NO_LIBRARY to shorten everything up a little bit.
-#ifndef QT_NO_LIBRARY
-#define QT_NO_LIBRARY 1
-#endif
-#endif
+# ifndef QT_NO_LIBRARY
+# define QT_NO_LIBRARY 1
+# endif
+#endif // Q_OS_WINRT
#if !defined(QT_NO_LIBRARY)
QT_BEGIN_INCLUDE_NAMESPACE
@@ -182,8 +177,6 @@ typedef DWORD (WINAPI *PtrGetEffectiveRightsFromAclW)(PACL, PTRUSTEE_W, OUT PACC
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;
@@ -233,7 +226,6 @@ static void resolveLibs()
#endif
triedResolve = true;
-#if !defined(Q_OS_WINCE)
HINSTANCE advapiHnd = QSystemLibrary::load(L"advapi32");
if (advapiHnd) {
ptrGetNamedSecurityInfoW = (PtrGetNamedSecurityInfoW)GetProcAddress(advapiHnd, "GetNamedSecurityInfoW");
@@ -279,10 +271,6 @@ static void resolveLibs()
HINSTANCE userenvHnd = QSystemLibrary::load(L"userenv");
if (userenvHnd)
ptrGetUserProfileDirectoryW = (PtrGetUserProfileDirectoryW)GetProcAddress(userenvHnd, "GetUserProfileDirectoryW");
- HINSTANCE kernel32 = LoadLibrary(L"kernel32");
- if(kernel32)
- ptrGetVolumePathNamesForVolumeNameW = (PtrGetVolumePathNamesForVolumeNameW)GetProcAddress(kernel32, "GetVolumePathNamesForVolumeNameW");
-#endif
}
}
#endif // QT_NO_LIBRARY
@@ -309,14 +297,14 @@ static bool resolveUNCLibs()
}
#endif
triedResolve = true;
-#if !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
+#if !defined(Q_OS_WINRT)
HINSTANCE hLib = QSystemLibrary::load(L"Netapi32");
if (hLib) {
ptrNetShareEnum = (PtrNetShareEnum)GetProcAddress(hLib, "NetShareEnum");
if (ptrNetShareEnum)
ptrNetApiBufferFree = (PtrNetApiBufferFree)GetProcAddress(hLib, "NetApiBufferFree");
}
-#endif // !Q_OS_WINCE && !Q_OS_WINRT
+#endif // !Q_OS_WINRT
}
return ptrNetShareEnum && ptrNetApiBufferFree;
}
@@ -324,7 +312,7 @@ static bool resolveUNCLibs()
static QString readSymLink(const QFileSystemEntry &link)
{
QString result;
-#if !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
+#if !defined(Q_OS_WINRT)
HANDLE handle = CreateFile((wchar_t*)link.nativeFilePath().utf16(),
FILE_READ_EA,
FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
@@ -357,27 +345,24 @@ static QString readSymLink(const QFileSystemEntry &link)
#if !defined(QT_NO_LIBRARY)
resolveLibs();
- if (ptrGetVolumePathNamesForVolumeNameW) {
- QRegExp matchVolName(QLatin1String("^Volume\\{([a-z]|[0-9]|-)+\\}\\\\"), Qt::CaseInsensitive);
- if(matchVolName.indexIn(result) == 0) {
- DWORD len;
- wchar_t buffer[MAX_PATH];
- QString volumeName = result.mid(0, matchVolName.matchedLength()).prepend(QLatin1String("\\\\?\\"));
- if(ptrGetVolumePathNamesForVolumeNameW((wchar_t*)volumeName.utf16(), buffer, MAX_PATH, &len) != 0)
- result.replace(0,matchVolName.matchedLength(), QString::fromWCharArray(buffer));
- }
+ QRegExp matchVolName(QLatin1String("^Volume\\{([a-z]|[0-9]|-)+\\}\\\\"), Qt::CaseInsensitive);
+ if (matchVolName.indexIn(result) == 0) {
+ DWORD len;
+ wchar_t buffer[MAX_PATH];
+ QString volumeName = result.mid(0, matchVolName.matchedLength()).prepend(QLatin1String("\\\\?\\"));
+ if (GetVolumePathNamesForVolumeName(reinterpret_cast<LPCWSTR>(volumeName.utf16()), buffer, MAX_PATH, &len) != 0)
+ result.replace(0,matchVolName.matchedLength(), QString::fromWCharArray(buffer));
}
-#endif // !Q_OS_WINCE && !Q_OS_WINRT
+#endif // !Q_OS_WINRT
}
#else
Q_UNUSED(link);
-#endif // Q_OS_WINCE || Q_OS_WINRT
+#endif // Q_OS_WINRT
return result;
}
static QString readLink(const QFileSystemEntry &link)
{
-#if !defined(Q_OS_WINCE)
#if !defined(QT_NO_LIBRARY)
QString ret;
@@ -418,31 +403,16 @@ static QString readLink(const QFileSystemEntry &link)
Q_UNUSED(link);
return QString();
#endif // QT_NO_LIBRARY
-#elif !defined(QT_NO_WINCE_SHELLSDK)
- wchar_t target[MAX_PATH];
- QString result;
- if (SHGetShortcutTarget((wchar_t*)QFileInfo(link.filePath()).absoluteFilePath().replace(QLatin1Char('/'),QLatin1Char('\\')).utf16(), target, MAX_PATH)) {
- result = QString::fromWCharArray(target);
- if (result.startsWith(QLatin1Char('"')))
- result.remove(0,1);
- if (result.endsWith(QLatin1Char('"')))
- result.remove(result.size()-1,1);
- }
- return result;
-#else // QT_NO_WINCE_SHELLSDK
- Q_UNUSED(link);
- return QString();
-#endif // Q_OS_WINCE
}
static bool uncShareExists(const QString &server)
{
// This code assumes the UNC path is always like \\?\UNC\server...
- QStringList parts = server.split(QLatin1Char('\\'), QString::SkipEmptyParts);
+ const QVector<QStringRef> parts = server.splitRef(QLatin1Char('\\'), QString::SkipEmptyParts);
if (parts.count() >= 3) {
QStringList shares;
if (QFileSystemEngine::uncListSharesOnServer(QLatin1String("\\\\") + parts.at(2), &shares))
- return parts.count() >= 4 ? shares.contains(parts.at(3), Qt::CaseInsensitive) : true;
+ return parts.count() < 4 || shares.contains(parts.at(3).toString(), Qt::CaseInsensitive);
}
return false;
}
@@ -533,7 +503,7 @@ QString QFileSystemEngine::nativeAbsoluteFilePath(const QString &path)
{
// can be //server or //server/share
QString absPath;
-#if !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT_WIN81)
+#if !defined(Q_OS_WINRT_WIN81)
QVarLengthArray<wchar_t, MAX_PATH> buf(qMax(MAX_PATH, path.size() + 1));
wchar_t *fileName = 0;
DWORD retLen = GetFullPathName((wchar_t*)path.utf16(), buf.size(), buf.data(), &fileName);
@@ -553,17 +523,12 @@ QString QFileSystemEngine::nativeAbsoluteFilePath(const QString &path)
if (absPath.size() < rootPath.size() && rootPath.startsWith(absPath))
absPath = rootPath;
# endif // Q_OS_WINRT
-#elif !defined(Q_OS_WINCE)
+#else // !Q_OS_WINRT_WIN81
if (QDir::isRelativePath(path))
absPath = QDir::toNativeSeparators(QDir::cleanPath(QDir::currentPath() + QLatin1Char('/') + path));
else
absPath = QDir::toNativeSeparators(QDir::cleanPath(path));
-#else // Q_OS_WINRT
- if (path.startsWith(QLatin1Char('/')) || path.startsWith(QLatin1Char('\\')))
- absPath = QDir::toNativeSeparators(path);
- else
- absPath = QDir::toNativeSeparators(QDir::cleanPath(qfsPrivateCurrentDir + QLatin1Char('/') + path));
-#endif // Q_OS_WINCE
+#endif // Q_OS_WINRT_WIN81
// This is really ugly, but GetFullPathName strips off whitespace at the end.
// If you for instance write ". " in the lineedit of QFileDialog,
// (which is an invalid filename) this function will strip the space off and viola,
@@ -580,15 +545,10 @@ QFileSystemEntry QFileSystemEngine::absoluteName(const QFileSystemEntry &entry)
QString ret;
if (!entry.isRelative()) {
-#if !defined(Q_OS_WINCE)
- if (entry.isAbsolute() && entry.isClean()) {
+ if (entry.isAbsolute() && entry.isClean())
ret = entry.filePath();
- } else {
+ else
ret = QDir::fromNativeSeparators(nativeAbsoluteFilePath(entry.filePath()));
- }
-#else
- ret = entry.filePath();
-#endif
} else {
#ifndef Q_OS_WINRT_WIN81
ret = QDir::cleanPath(QDir::currentPath() + QLatin1Char('/') + entry.filePath());
@@ -617,25 +577,14 @@ QFileSystemEntry QFileSystemEngine::absoluteName(const QFileSystemEntry &entry)
return QFileSystemEntry(ret, QFileSystemEntry::FromInternalPath());
}
-#ifndef Q_OS_WINCE
-
-// FILE_INFO_BY_HANDLE_CLASS has been extended by FileIdInfo = 18 as of VS2012.
-typedef enum { Q_FileIdInfo = 18 } Q_FILE_INFO_BY_HANDLE_CLASS;
-
-# if defined(Q_CC_MINGW) || (defined(Q_CC_MSVC) && (_MSC_VER < 1700 || WINVER <= 0x0601))
-
-// MinGW-64 defines FILE_ID_128 as of gcc-4.8.1 along with FILE_SUPPORTS_INTEGRITY_STREAMS
-# if !(defined(Q_CC_MINGW) && defined(FILE_SUPPORTS_INTEGRITY_STREAMS))
-typedef struct _FILE_ID_128 {
- BYTE Identifier[16];
-} FILE_ID_128, *PFILE_ID_128;
-# endif // !(Q_CC_MINGW && FILE_SUPPORTS_INTEGRITY_STREAMS)
+#if defined(Q_CC_MINGW) && WINVER < 0x0602 // Windows 8 onwards
typedef struct _FILE_ID_INFO {
ULONGLONG VolumeSerialNumber;
FILE_ID_128 FileId;
} FILE_ID_INFO, *PFILE_ID_INFO;
-# endif // if defined (Q_CC_MINGW) || (defined(Q_CC_MSVC) && (_MSC_VER < 1700 || WINVER <= 0x0601))
+
+#endif // if defined (Q_CC_MINGW) && WINVER < 0x0602
// File ID for Windows up to version 7.
static inline QByteArray fileId(HANDLE handle)
@@ -658,44 +607,26 @@ static inline QByteArray fileId(HANDLE handle)
// File ID for Windows starting from version 8.
QByteArray fileIdWin8(HANDLE handle)
{
-#ifndef Q_OS_WINRT
- typedef BOOL (WINAPI* GetFileInformationByHandleExType)(HANDLE, Q_FILE_INFO_BY_HANDLE_CLASS, void *, DWORD);
-
- // Dynamically resolve GetFileInformationByHandleEx (Vista onwards).
- static GetFileInformationByHandleExType getFileInformationByHandleEx = 0;
- if (!getFileInformationByHandleEx) {
- QSystemLibrary library(QLatin1String("kernel32"));
- getFileInformationByHandleEx = (GetFileInformationByHandleExType)library.resolve("GetFileInformationByHandleEx");
- }
- QByteArray result;
- if (getFileInformationByHandleEx) {
- FILE_ID_INFO infoEx;
- if (getFileInformationByHandleEx(handle, Q_FileIdInfo,
- &infoEx, sizeof(FILE_ID_INFO))) {
- result = QByteArray::number(infoEx.VolumeSerialNumber, 16);
- result += ':';
- // Note: MinGW-64's definition of FILE_ID_128 differs from the MSVC one.
- result += QByteArray((char *)&infoEx.FileId, sizeof(infoEx.FileId)).toHex();
- }
- }
-#else // !Q_OS_WINRT
+#if !defined(QT_BOOTSTRAPPED) && !defined(QT_BUILD_QMAKE)
QByteArray result;
FILE_ID_INFO infoEx;
- if (GetFileInformationByHandleEx(handle, FileIdInfo,
+ if (GetFileInformationByHandleEx(handle,
+ static_cast<FILE_INFO_BY_HANDLE_CLASS>(18), // FileIdInfo in Windows 8
&infoEx, sizeof(FILE_ID_INFO))) {
result = QByteArray::number(infoEx.VolumeSerialNumber, 16);
result += ':';
- result += QByteArray((char *)infoEx.FileId.Identifier, sizeof(infoEx.FileId.Identifier)).toHex();
+ // Note: MinGW-64's definition of FILE_ID_128 differs from the MSVC one.
+ result += QByteArray(reinterpret_cast<const char *>(&infoEx.FileId), int(sizeof(infoEx.FileId))).toHex();
}
-#endif // Q_OS_WINRT
return result;
+#else // !QT_BOOTSTRAPPED && !QT_BUILD_QMAKE
+ return fileId(handle);
+#endif
}
-#endif // !Q_OS_WINCE
//static
QByteArray QFileSystemEngine::id(const QFileSystemEntry &entry)
{
-#ifndef Q_OS_WINCE
QByteArray result;
const HANDLE handle =
#ifndef Q_OS_WINRT
@@ -711,9 +642,6 @@ QByteArray QFileSystemEngine::id(const QFileSystemEntry &entry)
CloseHandle(handle);
}
return result;
-#else // !Q_OS_WINCE
- return entry.nativeFilePath().toLower().toLatin1();
-#endif
}
//static
@@ -882,7 +810,7 @@ static bool tryDriveUNCFallback(const QFileSystemEntry &fname, QFileSystemMetaDa
{
bool entryExists = false;
DWORD fileAttrib = 0;
-#if !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
+#if !defined(Q_OS_WINRT)
if (fname.isDriveRoot()) {
// a valid drive ??
const UINT oldErrorMode = ::SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOOPENFILEERRORBOX);
@@ -925,7 +853,7 @@ static bool tryDriveUNCFallback(const QFileSystemEntry &fname, QFileSystemMetaDa
fileAttrib = FILE_ATTRIBUTE_DIRECTORY;
entryExists = true;
}
-#if !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
+#if !defined(Q_OS_WINRT)
}
#endif
if (entryExists)
@@ -949,7 +877,6 @@ static bool tryFindFallback(const QFileSystemEntry &fname, QFileSystemMetaData &
return filledData;
}
-#if !defined(Q_OS_WINCE)
//static
bool QFileSystemEngine::fillMetaData(int fd, QFileSystemMetaData &data,
QFileSystemMetaData::MetaDataFlags what)
@@ -960,7 +887,6 @@ bool QFileSystemEngine::fillMetaData(int fd, QFileSystemMetaData &data,
}
return false;
}
-#endif
//static
bool QFileSystemEngine::fillMetaData(HANDLE fHandle, QFileSystemMetaData &data,
@@ -1069,25 +995,6 @@ static inline bool mkDir(const QString &path, DWORD *lastError = 0)
{
if (lastError)
*lastError = 0;
-#if defined(Q_OS_WINCE)
- // Unfortunately CreateDirectory returns true for paths longer than
- // 256, but does not create a directory. It starts to fail, when
- // path length > MAX_PATH, which is 260 usually on CE.
- // This only happens on a Windows Mobile device. Windows CE seems
- // not to be affected by this.
- static int platformId = 0;
- if (platformId == 0) {
- wchar_t platformString[64];
- if (SystemParametersInfo(SPI_GETPLATFORMTYPE, sizeof(platformString)/sizeof(*platformString),platformString,0)) {
- if (0 == wcscmp(platformString, L"PocketPC") || 0 == wcscmp(platformString, L"Smartphone"))
- platformId = 1;
- else
- platformId = 2;
- }
- }
- if (platformId == 1 && QFSFileEnginePrivate::longFileName(path).size() > 256)
- return false;
-#endif
const QString longPath = QFSFileEnginePrivate::longFileName(path);
const bool result = ::CreateDirectory((wchar_t*)longPath.utf16(), 0);
if (lastError) // Capture lastError before any QString is freed since custom allocators might change it.
@@ -1200,9 +1107,10 @@ bool QFileSystemEngine::removeDirectory(const QFileSystemEntry &entry, bool remo
if (removeEmptyParents) {
dirName = QDir::toNativeSeparators(QDir::cleanPath(dirName));
for (int oldslash = 0, slash=dirName.length(); slash > 0; oldslash = slash) {
- QString chunk = dirName.left(slash);
- if (chunk.length() == 2 && chunk.at(0).isLetter() && chunk.at(1) == QLatin1Char(':'))
+ const QStringRef chunkRef = dirName.leftRef(slash);
+ if (chunkRef.length() == 2 && chunkRef.at(0).isLetter() && chunkRef.at(1) == QLatin1Char(':'))
break;
+ const QString chunk = chunkRef.toString();
if (!isDirPath(chunk, 0))
return false;
if (!rmDir(chunk))
@@ -1217,9 +1125,7 @@ bool QFileSystemEngine::removeDirectory(const QFileSystemEntry &entry, bool remo
//static
QString QFileSystemEngine::rootPath()
{
-#if defined(Q_OS_WINCE)
- QString ret = QLatin1String("/");
-#elif defined(Q_OS_WINRT)
+#if defined(Q_OS_WINRT)
// We specify the package root as root directory
QString ret = QLatin1String("/");
// Get package location
@@ -1285,13 +1191,8 @@ QString QFileSystemEngine::homePath()
+ QString::fromLocal8Bit(qgetenv("HOMEPATH"));
if (ret.isEmpty() || !QFile::exists(ret)) {
ret = QString::fromLocal8Bit(qgetenv("HOME"));
- if (ret.isEmpty() || !QFile::exists(ret)) {
-#if defined(Q_OS_WINCE)
- ret = QLatin1String("\\My Documents");
- if (!QFile::exists(ret))
-#endif
- ret = rootPath();
- }
+ if (ret.isEmpty() || !QFile::exists(ret))
+ ret = rootPath();
}
}
}
@@ -1304,10 +1205,6 @@ QString QFileSystemEngine::tempPath()
#ifndef Q_OS_WINRT
wchar_t tempPath[MAX_PATH];
const DWORD len = GetTempPath(MAX_PATH, tempPath);
-#ifdef Q_OS_WINCE
- if (len)
- ret = QString::fromWCharArray(tempPath, len);
-#else // Q_OS_WINCE
if (len) { // GetTempPath() can return short names, expand.
wchar_t longTempPath[MAX_PATH];
const DWORD longLen = GetLongPathName(tempPath, longTempPath, MAX_PATH);
@@ -1315,7 +1212,6 @@ QString QFileSystemEngine::tempPath()
QString::fromWCharArray(longTempPath, longLen) :
QString::fromWCharArray(tempPath, len);
}
-#endif // !Q_OS_WINCE
if (!ret.isEmpty()) {
while (ret.endsWith(QLatin1Char('\\')))
ret.chop(1);
@@ -1343,11 +1239,7 @@ QString QFileSystemEngine::tempPath()
ret = QDir::fromNativeSeparators(QString::fromWCharArray(path.GetRawBuffer(nullptr)));
#endif // Q_OS_WINRT
if (ret.isEmpty()) {
-#if !defined(Q_OS_WINCE)
ret = QLatin1String("C:/tmp");
-#else
- ret = QLatin1String("/Temp");
-#endif
} else if (ret.length() >= 2 && ret[1] == QLatin1Char(':'))
ret[0] = ret.at(0).toUpper(); // Force uppercase drive letters.
return ret;
@@ -1360,7 +1252,7 @@ bool QFileSystemEngine::setCurrentPath(const QFileSystemEntry &entry)
if(!(meta.exists() && meta.isDirectory()))
return false;
-#if !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT_WIN81)
+#if !defined(Q_OS_WINRT_WIN81)
//TODO: this should really be using nativeFilePath(), but that returns a path in long format \\?\c:\foo
//which causes many problems later on when it's returned through currentPath()
return ::SetCurrentDirectory(reinterpret_cast<const wchar_t*>(QDir::toNativeSeparators(entry.filePath()).utf16())) != 0;
@@ -1373,7 +1265,7 @@ bool QFileSystemEngine::setCurrentPath(const QFileSystemEntry &entry)
QFileSystemEntry QFileSystemEngine::currentPath()
{
QString ret;
-#if !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT_WIN81)
+#if !defined(Q_OS_WINRT_WIN81)
DWORD size = 0;
wchar_t currentName[PATH_MAX];
size = ::GetCurrentDirectory(PATH_MAX, currentName);
@@ -1389,17 +1281,13 @@ QFileSystemEntry QFileSystemEngine::currentPath()
}
if (ret.length() >= 2 && ret[1] == QLatin1Char(':'))
ret[0] = ret.at(0).toUpper(); // Force uppercase drive letters.
-#else // !Q_OS_WINCE && !Q_OS_WINRT_WIN81
+#else // !Q_OS_WINRT_WIN81
//TODO - a race condition exists when using currentPath / setCurrentPath from multiple threads
if (qfsPrivateCurrentDir.isEmpty())
-#ifndef Q_OS_WINRT_WIN81
- qfsPrivateCurrentDir = QCoreApplication::applicationDirPath();
-#else
qfsPrivateCurrentDir = QDir::rootPath();
-#endif
ret = qfsPrivateCurrentDir;
-#endif // Q_OS_WINCE || Q_OS_WINRT_WIN81
+#endif // Q_OS_WINRT_WIN81
return QFileSystemEntry(ret, QFileSystemEntry::FromNativePath());
}
@@ -1482,31 +1370,11 @@ static inline QDateTime fileTimeToQDateTime(const FILETIME *time)
{
QDateTime ret;
-#if defined(Q_OS_WINCE)
- SYSTEMTIME systime;
- FILETIME ftime;
- systime.wYear = 1970;
- systime.wMonth = 1;
- systime.wDay = 1;
- systime.wHour = 0;
- systime.wMinute = 0;
- systime.wSecond = 0;
- systime.wMilliseconds = 0;
- systime.wDayOfWeek = 4;
- SystemTimeToFileTime(&systime, &ftime);
- unsigned __int64 acttime = (unsigned __int64)time->dwHighDateTime << 32 | time->dwLowDateTime;
- FileTimeToSystemTime(time, &systime);
- unsigned __int64 time1970 = (unsigned __int64)ftime.dwHighDateTime << 32 | ftime.dwLowDateTime;
- unsigned __int64 difftime = acttime - time1970;
- difftime /= 10000000;
- ret.setTime_t((unsigned int)difftime);
-#else
SYSTEMTIME sTime, lTime;
FileTimeToSystemTime(time, &sTime);
SystemTimeToTzSpecificLocalTime(0, &sTime, &lTime);
ret.setDate(QDate(lTime.wYear, lTime.wMonth, lTime.wDay));
ret.setTime(QTime(lTime.wHour, lTime.wMinute, lTime.wSecond, lTime.wMilliseconds));
-#endif
return ret;
}
diff --git a/src/corelib/io/qfilesystementry_p.h b/src/corelib/io/qfilesystementry_p.h
index 6bb8fc2400..300a375377 100644
--- a/src/corelib/io/qfilesystementry_p.h
+++ b/src/corelib/io/qfilesystementry_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtCore/private/qglobal_p.h>
#include <QtCore/qstring.h>
#include <QtCore/qbytearray.h>
diff --git a/src/corelib/io/qfilesystemiterator_win.cpp b/src/corelib/io/qfilesystemiterator_win.cpp
index ba195b2330..2ce7bd7a4b 100644
--- a/src/corelib/io/qfilesystemiterator_win.cpp
+++ b/src/corelib/io/qfilesystemiterator_win.cpp
@@ -40,6 +40,7 @@
#include "qfilesystemiterator_p.h"
#include "qfilesystemengine_p.h"
#include "qplatformdefs.h"
+#include "qvector.h"
#include <QtCore/qt_windows.h>
@@ -92,12 +93,10 @@ 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
@@ -105,7 +104,7 @@ bool QFileSystemIterator::advance(QFileSystemEntry &fileEntry, QFileSystemMetaDa
FINDEX_SEARCH_OPS(searchOps), 0, dwAdditionalFlags);
if (findFileHandle == INVALID_HANDLE_VALUE) {
if (nativePath.startsWith(QLatin1String("\\\\?\\UNC\\"))) {
- QStringList parts = nativePath.split(QLatin1Char('\\'), QString::SkipEmptyParts);
+ const QVector<QStringRef> parts = nativePath.splitRef(QLatin1Char('\\'), QString::SkipEmptyParts);
if (parts.count() == 4 && QFileSystemEngine::uncListSharesOnServer(
QLatin1String("\\\\") + parts.at(2), &uncShares)) {
if (uncShares.isEmpty())
diff --git a/src/corelib/io/qfilesystemmetadata_p.h b/src/corelib/io/qfilesystemmetadata_p.h
index 7135c9b19b..9507a101a8 100644
--- a/src/corelib/io/qfilesystemmetadata_p.h
+++ b/src/corelib/io/qfilesystemmetadata_p.h
@@ -276,9 +276,9 @@ inline QDateTime QFileSystemMetaData::fileTime(QAbstractFileEngine::FileTime tim
#endif
#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_); }
+inline QDateTime QFileSystemMetaData::creationTime() const { return QDateTime::fromSecsSinceEpoch(creationTime_); }
+inline QDateTime QFileSystemMetaData::modificationTime() const { return QDateTime::fromSecsSinceEpoch(modificationTime_); }
+inline QDateTime QFileSystemMetaData::accessTime() const { return QDateTime::fromSecsSinceEpoch(accessTime_); }
inline uint QFileSystemMetaData::userId() const { return userId_; }
inline uint QFileSystemMetaData::groupId() const { return groupId_; }
@@ -331,13 +331,10 @@ inline void QFileSystemMetaData::fillFromFindData(WIN32_FIND_DATA &findData, boo
if (setLinkType) {
knownFlagsMask |= LinkType;
entryFlags &= ~LinkType;
-#if !defined(Q_OS_WINCE)
if ((fileAttribute_ & FILE_ATTRIBUTE_REPARSE_POINT)
&& (findData.dwReserved0 == IO_REPARSE_TAG_SYMLINK)) {
entryFlags |= LinkType;
}
-#endif
-
}
}
diff --git a/src/corelib/io/qfilesystemwatcher.cpp b/src/corelib/io/qfilesystemwatcher.cpp
index acea610625..55f4bddd17 100644
--- a/src/corelib/io/qfilesystemwatcher.cpp
+++ b/src/corelib/io/qfilesystemwatcher.cpp
@@ -58,7 +58,7 @@
# include "qfilesystemwatcher_win_p.h"
#elif defined(USE_INOTIFY)
# include "qfilesystemwatcher_inotify_p.h"
-#elif defined(Q_OS_FREEBSD) || defined(Q_OS_NETBSD) || defined(Q_OS_OPENBSD) || defined(Q_OS_IOS)
+#elif defined(Q_OS_FREEBSD) || defined(Q_OS_NETBSD) || defined(Q_OS_OPENBSD) || defined(QT_PLATFORM_UIKIT)
# include "qfilesystemwatcher_kqueue_p.h"
#elif defined(Q_OS_OSX)
# include "qfilesystemwatcher_fsevents_p.h"
@@ -74,7 +74,7 @@ QFileSystemWatcherEngine *QFileSystemWatcherPrivate::createNativeEngine(QObject
// there is a chance that inotify may fail on Linux pre-2.6.13 (August
// 2005), so we can't just new inotify directly.
return QInotifyFileSystemWatcherEngine::create(parent);
-#elif defined(Q_OS_FREEBSD) || defined(Q_OS_NETBSD) || defined(Q_OS_OPENBSD) || defined(Q_OS_IOS)
+#elif defined(Q_OS_FREEBSD) || defined(Q_OS_NETBSD) || defined(Q_OS_OPENBSD) || defined(QT_PLATFORM_UIKIT)
return QKqueueFileSystemWatcherEngine::create(parent);
#elif defined(Q_OS_OSX)
return QFseventsFileSystemWatcherEngine::create(parent);
diff --git a/src/corelib/io/qfilesystemwatcher_fsevents.mm b/src/corelib/io/qfilesystemwatcher_fsevents.mm
index be9eef889a..beb8acb05f 100644
--- a/src/corelib/io/qfilesystemwatcher_fsevents.mm
+++ b/src/corelib/io/qfilesystemwatcher_fsevents.mm
@@ -198,7 +198,7 @@ void QFseventsFileSystemWatcherEngine::processEvent(ConstFSEventStreamRef stream
const FSEventStreamEventFlags eventFlags[],
const FSEventStreamEventId eventIds[])
{
-#if defined(Q_OS_OSX) && MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_6
+#if defined(Q_OS_OSX)
Q_UNUSED(streamRef);
bool needsRestart = false;
@@ -256,12 +256,6 @@ void QFseventsFileSystemWatcherEngine::processEvent(ConstFSEventStreamRef stream
if (needsRestart)
emit scheduleStreamRestart();
#else
- // This is a work-around for moc: when we put the version check at the top of the header file,
- // moc will still see the Q_OBJECT macro and generate a meta-object when compiling for 10.6,
- // which obviously won't link.
- //
- // So the trick is to still compile this class on 10.6, but never instantiate it.
-
Q_UNUSED(streamRef);
Q_UNUSED(numEvents);
Q_UNUSED(eventPaths);
diff --git a/src/corelib/io/qfilesystemwatcher_win.cpp b/src/corelib/io/qfilesystemwatcher_win.cpp
index e8b49db9f3..be56d8dd1d 100644
--- a/src/corelib/io/qfilesystemwatcher_win.cpp
+++ b/src/corelib/io/qfilesystemwatcher_win.cpp
@@ -86,13 +86,9 @@ QStringList QWindowsFileSystemWatcherEngine::addPaths(const QStringList &paths,
QString path = it.next();
QString normalPath = path;
if ((normalPath.endsWith(QLatin1Char('/')) && !normalPath.endsWith(QLatin1String(":/")))
- || (normalPath.endsWith(QLatin1Char('\\')) && !normalPath.endsWith(QLatin1String(":\\")))
-#ifdef Q_OS_WINCE
- && normalPath.size() > 1)
-#else
- )
-#endif
- normalPath.chop(1);
+ || (normalPath.endsWith(QLatin1Char('\\')) && !normalPath.endsWith(QLatin1String(":\\")))) {
+ normalPath.chop(1);
+ }
QFileInfo fileInfo(normalPath);
if (!fileInfo.exists())
continue;
diff --git a/src/corelib/io/qfsfileengine.cpp b/src/corelib/io/qfsfileengine.cpp
index 2cda4d6bda..098bc49468 100644
--- a/src/corelib/io/qfsfileengine.cpp
+++ b/src/corelib/io/qfsfileengine.cpp
@@ -48,9 +48,7 @@
#ifndef QT_NO_FSFILEENGINE
-#if !defined(Q_OS_WINCE)
#include <errno.h>
-#endif
#if defined(Q_OS_UNIX)
#include "private/qcore_unix_p.h"
#endif
@@ -125,10 +123,8 @@ void QFSFileEnginePrivate::init()
{
is_sequential = 0;
tried_stat = 0;
-#if !defined(Q_OS_WINCE)
need_lstat = 1;
is_link = 0;
-#endif
openMode = QIODevice::NotOpen;
fd = -1;
fh = 0;
@@ -139,10 +135,8 @@ void QFSFileEnginePrivate::init()
fileAttrib = INVALID_FILE_ATTRIBUTES;
fileHandle = INVALID_HANDLE_VALUE;
mapHandle = NULL;
-#ifndef Q_OS_WINCE
cachedFd = -1;
#endif
-#endif
}
/*!
@@ -551,7 +545,7 @@ bool QFSFileEnginePrivate::seekFdFh(qint64 pos)
} else {
// Unbuffered stdio mode.
if (QT_LSEEK(fd, QT_OFF_T(pos), SEEK_SET) == -1) {
- qWarning() << "QFile::at: Cannot set file position" << pos;
+ qWarning("QFile::at: Cannot set file position %lld", pos);
q->setError(QFile::PositionError, qt_error_string(errno));
return false;
}
diff --git a/src/corelib/io/qfsfileengine_p.h b/src/corelib/io/qfsfileengine_p.h
index dd498a5bc5..593ecc2687 100644
--- a/src/corelib/io/qfsfileengine_p.h
+++ b/src/corelib/io/qfsfileengine_p.h
@@ -61,10 +61,6 @@
QT_BEGIN_NAMESPACE
-#if defined(Q_OS_WINCE_STD) && _WIN32_WCE < 0x600
-#define Q_USE_DEPRECATED_MAP_API 1
-#endif
-
class QFSFileEnginePrivate;
class Q_CORE_EXPORT QFSFileEngine : public QAbstractFileEngine
@@ -184,10 +180,7 @@ public:
HANDLE mapHandle;
QHash<uchar *, DWORD /* offset % AllocationGranularity */> maps;
-#ifndef Q_OS_WINCE
mutable int cachedFd;
-#endif
-
mutable DWORD fileAttrib;
#else
QHash<uchar *, QPair<int /*offset % PageSize*/, size_t /*length + offset % PageSize*/> > maps;
@@ -206,10 +199,8 @@ public:
mutable uint is_sequential : 2;
mutable uint tried_stat : 1;
-#if !defined(Q_OS_WINCE)
mutable uint need_lstat : 1;
mutable uint is_link : 1;
-#endif
#if defined(Q_OS_WIN)
bool doStat(QFileSystemMetaData::MetaDataFlags flags) const;
diff --git a/src/corelib/io/qfsfileengine_win.cpp b/src/corelib/io/qfsfileengine_win.cpp
index c37a690646..70c347978e 100644
--- a/src/corelib/io/qfsfileengine_win.cpp
+++ b/src/corelib/io/qfsfileengine_win.cpp
@@ -50,13 +50,9 @@
#include "qdatetime.h"
#include "qt_windows.h"
-#if !defined(Q_OS_WINCE)
-# include <sys/types.h>
-# include <direct.h>
-# include <winioctl.h>
-#else
-# include <types.h>
-#endif
+#include <sys/types.h>
+#include <direct.h>
+#include <winioctl.h>
#include <objbase.h>
#ifndef Q_OS_WINRT
# include <shlobj.h>
@@ -77,14 +73,12 @@
QT_BEGIN_NAMESPACE
-#if !defined(Q_OS_WINCE)
static inline bool isUncPath(const QString &path)
{
// Starts with \\, but not \\.
return (path.startsWith(QLatin1String("\\\\"))
&& path.size() > 2 && path.at(2) != QLatin1Char('.'));
}
-#endif
/*!
\internal
@@ -95,7 +89,7 @@ QString QFSFileEnginePrivate::longFileName(const QString &path)
return path;
QString absPath = QFileSystemEngine::nativeAbsoluteFilePath(path);
-#if !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
+#if !defined(Q_OS_WINRT)
QString prefix = QLatin1String("\\\\?\\");
if (isUncPath(absPath)) {
prefix.append(QLatin1String("UNC\\")); // "\\\\?\\UNC\\"
@@ -171,7 +165,6 @@ bool QFSFileEnginePrivate::nativeClose()
// Windows native mode.
bool ok = true;
-#ifndef Q_OS_WINCE
if (cachedFd != -1) {
if (::_close(cachedFd) && !::CloseHandle(fileHandle)) {
q->setError(QFile::UnspecifiedError, qt_error_string());
@@ -184,7 +177,6 @@ bool QFSFileEnginePrivate::nativeClose()
return ok;
}
-#endif
if ((fileHandle == INVALID_HANDLE_VALUE || !::CloseHandle(fileHandle))) {
q->setError(QFile::UnspecifiedError, qt_error_string());
@@ -238,24 +230,6 @@ qint64 QFSFileEnginePrivate::nativeSize() const
// Always retrive the current information
metaData.clearFlags(QFileSystemMetaData::SizeAttribute);
-#if defined(Q_OS_WINCE)
- // Buffered stdlib mode.
- if (fh) {
- QT_OFF_T oldPos = QT_FTELL(fh);
- QT_FSEEK(fh, 0, SEEK_END);
- qint64 fileSize = (qint64)QT_FTELL(fh);
- QT_FSEEK(fh, oldPos, SEEK_SET);
- if (fileSize == -1) {
- fileSize = 0;
- thatQ->setError(QFile::UnspecifiedError, qt_error_string(errno));
- }
- return fileSize;
- }
- if (fd != -1) {
- thatQ->setError(QFile::UnspecifiedError, QLatin1String("Not implemented!"));
- return 0;
- }
-#endif
bool filled = false;
if (fileHandle != INVALID_HANDLE_VALUE && openMode != QIODevice::NotOpen )
filled = QFileSystemEngine::fillMetaData(fileHandle, metaData,
@@ -287,7 +261,6 @@ qint64 QFSFileEnginePrivate::nativePos() const
if (fileHandle == INVALID_HANDLE_VALUE)
return 0;
-#if !defined(Q_OS_WINCE)
LARGE_INTEGER currentFilePos;
LARGE_INTEGER offset;
offset.QuadPart = 0;
@@ -297,18 +270,6 @@ qint64 QFSFileEnginePrivate::nativePos() const
}
return qint64(currentFilePos.QuadPart);
-#else
- LARGE_INTEGER filepos;
- filepos.HighPart = 0;
- DWORD newFilePointer = SetFilePointer(fileHandle, 0, &filepos.HighPart, FILE_CURRENT);
- if (newFilePointer == 0xFFFFFFFF && GetLastError() != NO_ERROR) {
- thatQ->setError(QFile::UnspecifiedError, qt_error_string());
- return 0;
- }
-
- filepos.LowPart = newFilePointer;
- return filepos.QuadPart;
-#endif
}
/*
@@ -323,7 +284,6 @@ bool QFSFileEnginePrivate::nativeSeek(qint64 pos)
return seekFdFh(pos);
}
-#if !defined(Q_OS_WINCE)
LARGE_INTEGER currentFilePos;
LARGE_INTEGER offset;
offset.QuadPart = pos;
@@ -333,17 +293,6 @@ bool QFSFileEnginePrivate::nativeSeek(qint64 pos)
}
return true;
-#else
- DWORD newFilePointer;
- LARGE_INTEGER *li = reinterpret_cast<LARGE_INTEGER*>(&pos);
- newFilePointer = SetFilePointer(fileHandle, li->LowPart, &li->HighPart, FILE_BEGIN);
- if (newFilePointer == 0xFFFFFFFF && GetLastError() != NO_ERROR) {
- q->setError(QFile::PositionError, qt_error_string());
- return false;
- }
-
- return true;
-#endif
}
/*
@@ -462,7 +411,6 @@ int QFSFileEnginePrivate::nativeHandle() const
{
if (fh || fd != -1)
return fh ? QT_FILENO(fh) : fd;
-#ifndef Q_OS_WINCE
if (cachedFd != -1)
return cachedFd;
@@ -473,9 +421,6 @@ int QFSFileEnginePrivate::nativeHandle() const
flags |= _O_RDONLY;
cachedFd = _open_osfhandle((intptr_t) fileHandle, flags);
return cachedFd;
-#else
- return -1;
-#endif
}
/*
@@ -483,7 +428,7 @@ int QFSFileEnginePrivate::nativeHandle() const
*/
bool QFSFileEnginePrivate::nativeIsSequential() const
{
-#if !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
+#if !defined(Q_OS_WINRT)
HANDLE handle = fileHandle;
if (fh || fd != -1)
handle = (HANDLE)_get_osfhandle(fh ? QT_FILENO(fh) : fd);
@@ -531,35 +476,9 @@ bool QFSFileEngine::rename(const QString &newName)
bool QFSFileEngine::renameOverwrite(const QString &newName)
{
Q_D(QFSFileEngine);
-#if defined(Q_OS_WINCE)
- // Windows Embedded Compact 7 does not have MoveFileEx, simulate it with the following sequence:
- // 1. DeleteAndRenameFile (Should work on RAM FS when both files exist)
- // 2. DeleteFile/MoveFile (Should work on all file systems)
- //
- // DeleteFile/MoveFile fallback implementation violates atomicity, but it is more acceptable than
- // alternative CopyFile/DeleteFile sequence for the following reasons:
- //
- // 1. DeleteFile/MoveFile is way faster than CopyFile/DeleteFile and thus more atomic.
- // 2. Given the intended use case of this function in QSaveFile, DeleteFile/MoveFile sequence will
- // delete the old content, but leave a file "filename.ext.XXXXXX" in the same directory if MoveFile fails.
- // With CopyFile/DeleteFile sequence, it can happen that new data is partially copied to target file
- // (because CopyFile is not atomic either), thus leaving *some* content to target file.
- // This makes the need for application level recovery harder to detect than in DeleteFile/MoveFile
- // sequence where target file simply does not exist.
- //
- bool ret = ::DeleteAndRenameFile((wchar_t*)QFileSystemEntry(newName).nativeFilePath().utf16(),
- (wchar_t*)d->fileEntry.nativeFilePath().utf16()) != 0;
- if (!ret) {
- ret = ::DeleteFile((wchar_t*)QFileSystemEntry(newName).nativeFilePath().utf16()) != 0;
- if (ret || ::GetLastError() == ERROR_FILE_NOT_FOUND)
- ret = ::MoveFile((wchar_t*)d->fileEntry.nativeFilePath().utf16(),
- (wchar_t*)QFileSystemEntry(newName).nativeFilePath().utf16()) != 0;
- }
-#else
bool ret = ::MoveFileEx((wchar_t*)d->fileEntry.nativeFilePath().utf16(),
(wchar_t*)QFileSystemEntry(newName).nativeFilePath().utf16(),
MOVEFILE_REPLACE_EXISTING) != 0;
-#endif
if (!ret)
setError(QFile::RenameError, QSystemError(::GetLastError(), QSystemError::NativeError).toString());
return ret;
@@ -587,7 +506,7 @@ bool QFSFileEngine::setCurrentPath(const QString &path)
QString QFSFileEngine::currentPath(const QString &fileName)
{
-#if !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
+#if !defined(Q_OS_WINRT)
QString ret;
//if filename is a drive: then get the pwd of that drive
if (fileName.length() >= 2 &&
@@ -606,10 +525,10 @@ QString QFSFileEngine::currentPath(const QString &fileName)
if (ret.length() >= 2 && ret[1] == QLatin1Char(':'))
ret[0] = ret.at(0).toUpper(); // Force uppercase drive letters.
return ret;
-#else // !Q_OS_WINCE && !Q_OS_WINRT
+#else // !Q_OS_WINRT
Q_UNUSED(fileName);
return QFileSystemEngine::currentPath().filePath();
-#endif // Q_OS_WINCE || Q_OS_WINRT
+#endif // Q_OS_WINRT
}
QString QFSFileEngine::homePath()
@@ -630,12 +549,12 @@ QString QFSFileEngine::tempPath()
QFileInfoList QFSFileEngine::drives()
{
QFileInfoList ret;
-#if !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
-#if defined(Q_OS_WIN32)
+#if !defined(Q_OS_WINRT)
+# if defined(Q_OS_WIN32)
const UINT oldErrorMode = ::SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOOPENFILEERRORBOX);
quint32 driveBits = (quint32) GetLogicalDrives() & 0x3ffffff;
::SetErrorMode(oldErrorMode);
-#endif
+# endif
char driveName[] = "A:/";
while (driveBits) {
@@ -645,10 +564,10 @@ QFileInfoList QFSFileEngine::drives()
driveBits = driveBits >> 1;
}
return ret;
-#else // !Q_OS_WINCE && !Q_OS_WINRT
+#else // !Q_OS_WINRT
ret.append(QFileInfo(QLatin1String("/")));
return ret;
-#endif // Q_OS_WINCE || Q_OS_WINRT
+#endif // Q_OS_WINRT
}
bool QFSFileEnginePrivate::doStat(QFileSystemMetaData::MetaDataFlags flags) const
@@ -656,13 +575,11 @@ bool QFSFileEnginePrivate::doStat(QFileSystemMetaData::MetaDataFlags flags) cons
if (!tried_stat || !metaData.hasFlags(flags)) {
tried_stat = true;
-#if !defined(Q_OS_WINCE)
int localFd = fd;
if (fh && fileEntry.isEmpty())
localFd = QT_FILENO(fh);
if (localFd != -1)
QFileSystemEngine::fillMetaData(localFd, metaData, flags);
-#endif
if (metaData.missingFlags(flags) && !fileEntry.isEmpty())
QFileSystemEngine::fillMetaData(fileEntry, metaData, metaData.missingFlags(flags));
}
@@ -673,8 +590,8 @@ bool QFSFileEnginePrivate::doStat(QFileSystemMetaData::MetaDataFlags flags) cons
bool QFSFileEngine::link(const QString &newName)
{
-#if !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
-#if !defined(QT_NO_LIBRARY)
+#if !defined(Q_OS_WINRT)
+# if !defined(QT_NO_LIBRARY)
bool ret = false;
QString linkName = newName;
@@ -715,24 +632,11 @@ bool QFSFileEngine::link(const QString &newName)
CoUninitialize();
return ret;
-#else
+# else // QT_NO_LIBRARY
Q_UNUSED(newName);
return false;
-#endif // QT_NO_LIBRARY
-#elif defined(Q_OS_WINCE) && !defined(QT_NO_WINCE_SHELLSDK)
- QString linkName = newName;
- linkName.replace(QLatin1Char('/'), QLatin1Char('\\'));
- if (!linkName.endsWith(QLatin1String(".lnk")))
- linkName += QLatin1String(".lnk");
- QString orgName = fileName(AbsoluteName).replace(QLatin1Char('/'), QLatin1Char('\\'));
- // Need to append on our own
- orgName.prepend(QLatin1Char('"'));
- orgName.append(QLatin1Char('"'));
- bool ret = SUCCEEDED(SHCreateShortcut((wchar_t*)linkName.utf16(), (wchar_t*)orgName.utf16()));
- if (!ret)
- setError(QFile::RenameError, qt_error_string());
- return ret;
-#else // Q_OS_WINCE && !QT_NO_WINCE_SHELLSDK
+# endif // QT_NO_LIBRARY
+#else // !Q_OS_WINRT
Q_UNUSED(newName);
Q_UNIMPLEMENTED();
return false;
@@ -813,7 +717,6 @@ QString QFSFileEngine::fileName(FileName file) const
QString ret;
if (!isRelativePath()) {
-#if !defined(Q_OS_WINCE)
if (d->fileEntry.filePath().startsWith(QLatin1Char('/')) || // It's a absolute path to the current drive, so \a.txt -> Z:\a.txt
d->fileEntry.filePath().size() == 2 || // It's a drive letter that needs to get a working dir appended
(d->fileEntry.filePath().size() > 2 && d->fileEntry.filePath().at(2) != QLatin1Char('/')) || // It's a drive-relative path, so Z:a.txt -> Z:\currentpath\a.txt
@@ -821,9 +724,7 @@ QString QFSFileEngine::fileName(FileName file) const
d->fileEntry.filePath().endsWith(QLatin1String("/..")) || d->fileEntry.filePath().endsWith(QLatin1String("/.")))
{
ret = QDir::fromNativeSeparators(QFileSystemEngine::nativeAbsoluteFilePath(d->fileEntry.filePath()));
- } else
-#endif
- {
+ } else {
ret = d->fileEntry.filePath();
}
} else {
@@ -905,14 +806,12 @@ bool QFSFileEngine::setSize(qint64 size)
if (d->fileHandle != INVALID_HANDLE_VALUE || d->fd != -1 || d->fh) {
// resize open file
HANDLE fh = d->fileHandle;
-#if !defined(Q_OS_WINCE)
if (fh == INVALID_HANDLE_VALUE) {
if (d->fh)
fh = (HANDLE)_get_osfhandle(QT_FILENO(d->fh));
else
fh = (HANDLE)_get_osfhandle(d->fd);
}
-#endif
if (fh == INVALID_HANDLE_VALUE)
return false;
qint64 currentPos = pos();
@@ -984,10 +883,8 @@ uchar *QFSFileEnginePrivate::map(qint64 offset, qint64 size,
// get handle to the file
HANDLE handle = fileHandle;
-#ifndef Q_OS_WINCE
if (handle == INVALID_HANDLE_VALUE && fh)
handle = (HANDLE)::_get_osfhandle(QT_FILENO(fh));
-#endif
#ifdef Q_USE_DEPRECATED_MAP_API
nativeClose();
diff --git a/src/corelib/io/qiodevice.cpp b/src/corelib/io/qiodevice.cpp
index f31ac75425..94fb68450c 100644
--- a/src/corelib/io/qiodevice.cpp
+++ b/src/corelib/io/qiodevice.cpp
@@ -1148,34 +1148,31 @@ QByteArray QIODevice::read(qint64 maxSize)
Q_D(QIODevice);
QByteArray result;
- CHECK_MAXLEN(read, result);
-
#if defined QIODEVICE_DEBUG
printf("%p QIODevice::read(%lld), d->pos = %lld, d->buffer.size() = %lld\n",
this, maxSize, d->pos, d->buffer.size());
#endif
+ // Try to prevent the data from being copied, if we have a chunk
+ // with the same size in the read buffer.
+ if (maxSize == d->buffer.nextDataBlockSize() && !d->transactionStarted
+ && (d->openMode & (QIODevice::ReadOnly | QIODevice::Text)) == QIODevice::ReadOnly) {
+ result = d->buffer.read();
+ if (!d->isSequential())
+ d->pos += maxSize;
+ if (d->buffer.isEmpty())
+ readData(nullptr, 0);
+ return result;
+ }
+
+ CHECK_MAXLEN(read, result);
if (maxSize >= MaxByteArraySize) {
checkWarnMessage(this, "read", "maxSize argument exceeds QByteArray size limit");
maxSize = MaxByteArraySize - 1;
}
- qint64 readBytes = 0;
- if (maxSize) {
- result.resize(int(maxSize));
- if (!result.size()) {
- // If resize fails, read incrementally.
- qint64 readResult;
- do {
- result.resize(int(qMin(maxSize, qint64(result.size() + d->readBufferChunkSize))));
- readResult = read(result.data() + readBytes, result.size() - readBytes);
- if (readResult > 0 || readBytes == 0)
- readBytes += readResult;
- } while (readResult == d->readBufferChunkSize);
- } else {
- readBytes = read(result.data(), result.size());
- }
- }
+ result.resize(int(maxSize));
+ qint64 readBytes = read(result.data(), result.size());
if (readBytes <= 0)
result.clear();
diff --git a/src/corelib/io/qipaddress_p.h b/src/corelib/io/qipaddress_p.h
index 52fa9c05ad..5a478ae27b 100644
--- a/src/corelib/io/qipaddress_p.h
+++ b/src/corelib/io/qipaddress_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtCore/private/qglobal_p.h>
#include "qstring.h"
QT_BEGIN_NAMESPACE
diff --git a/src/corelib/io/qlockfile_p.h b/src/corelib/io/qlockfile_p.h
index d7f2a1d52d..86a606ec00 100644
--- a/src/corelib/io/qlockfile_p.h
+++ b/src/corelib/io/qlockfile_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtCore/private/qglobal_p.h>
#include <QtCore/qlockfile.h>
#include <QtCore/qfile.h>
diff --git a/src/corelib/io/qlockfile_unix.cpp b/src/corelib/io/qlockfile_unix.cpp
index 0895f9a3fc..924d2e7214 100644
--- a/src/corelib/io/qlockfile_unix.cpp
+++ b/src/corelib/io/qlockfile_unix.cpp
@@ -70,7 +70,7 @@
# include <cstdio>
#elif defined(Q_OS_HAIKU)
# include <kernel/OS.h>
-#elif defined(Q_OS_BSD4) && !defined(Q_OS_IOS)
+#elif defined(Q_OS_BSD4) && !defined(QT_PLATFORM_UIKIT)
# include <sys/cdefs.h>
# include <sys/param.h>
# include <sys/sysctl.h>
@@ -283,7 +283,7 @@ QString QLockFilePrivate::processNameByPid(qint64 pid)
if (get_thread_info(pid, &info) != B_OK)
return QString();
return QFile::decodeName(info.name);
-#elif defined(Q_OS_BSD4) && !defined(Q_OS_IOS)
+#elif defined(Q_OS_BSD4) && !defined(QT_PLATFORM_UIKIT)
# if defined(Q_OS_NETBSD)
struct kinfo_proc2 kp;
int mib[6] = { CTL_KERN, KERN_PROC2, KERN_PROC_PID, (int)pid, sizeof(struct kinfo_proc2), 1 };
diff --git a/src/corelib/io/qlockfile_win.cpp b/src/corelib/io/qlockfile_win.cpp
index 4afab3d135..baaff8da17 100644
--- a/src/corelib/io/qlockfile_win.cpp
+++ b/src/corelib/io/qlockfile_win.cpp
@@ -100,7 +100,7 @@ QLockFile::LockError QLockFilePrivate::tryLock_sys()
? QLockFile::LockFailedError
: QLockFile::PermissionError;
default:
- qWarning() << "Got unexpected locking error" << lastError;
+ qWarning("Got unexpected locking error %llu", quint64(lastError));
return QLockFile::UnknownError;
}
}
@@ -165,7 +165,7 @@ bool QLockFilePrivate::isApparentlyStale() const
QString QLockFilePrivate::processNameByPid(qint64 pid)
{
-#if !defined(Q_OS_WINRT) && !defined(Q_OS_WINCE)
+#if !defined(Q_OS_WINRT)
typedef DWORD (WINAPI *GetModuleFileNameExFunc)(HANDLE, HMODULE, LPTSTR, DWORD);
HMODULE hPsapi = LoadLibraryA("psapi");
diff --git a/src/corelib/io/qloggingregistry_p.h b/src/corelib/io/qloggingregistry_p.h
index b8b62e034f..5197da1ba4 100644
--- a/src/corelib/io/qloggingregistry_p.h
+++ b/src/corelib/io/qloggingregistry_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtCore/private/qglobal_p.h>
#include <QtCore/qloggingcategory.h>
#include <QtCore/qmap.h>
#include <QtCore/qmutex.h>
diff --git a/src/corelib/io/qprocess.cpp b/src/corelib/io/qprocess.cpp
index 914d4421d0..ebafd6b524 100644
--- a/src/corelib/io/qprocess.cpp
+++ b/src/corelib/io/qprocess.cpp
@@ -48,9 +48,6 @@
#if defined QPROCESS_DEBUG
#include <qstring.h>
#include <ctype.h>
-#if !defined(Q_OS_WINCE)
-#include <errno.h>
-#endif
QT_BEGIN_NAMESPACE
/*
@@ -1988,13 +1985,6 @@ qint64 QProcess::writeData(const char *data, qint64 len)
{
Q_D(QProcess);
-#if defined(Q_OS_WINCE)
- Q_UNUSED(data);
- Q_UNUSED(len);
- d->setErrorAndEmit(QProcess::WriteError);
- return -1;
-#endif
-
if (d->stdinChannel.closed) {
#if defined QPROCESS_DEBUG
qDebug("QProcess::writeData(%p \"%s\", %lld) == 0 (write channel closing)",
@@ -2171,7 +2161,6 @@ void QProcessPrivate::start(QIODevice::OpenMode mode)
mode &= ~QIODevice::ReadOnly; // not open for reading
if (mode == 0)
mode = QIODevice::Unbuffered;
-#ifndef Q_OS_WINCE
if ((mode & QIODevice::ReadOnly) == 0) {
if (stdoutChannel.type == QProcessPrivate::Channel::Normal)
q->setStandardOutputFile(q->nullDevice());
@@ -2179,7 +2168,6 @@ void QProcessPrivate::start(QIODevice::OpenMode mode)
&& processChannelMode != QProcess::MergedChannels)
q->setStandardErrorFile(q->nullDevice());
}
-#endif
q->QIODevice::open(mode);
@@ -2537,7 +2525,7 @@ QT_BEGIN_INCLUDE_NAMESPACE
#if defined(Q_OS_MACX)
# include <crt_externs.h>
# define environ (*_NSGetEnviron())
-#elif defined(Q_OS_WINCE) || defined(Q_OS_IOS)
+#elif defined(QT_PLATFORM_UIKIT)
static char *qt_empty_environ[] = { 0 };
#define environ qt_empty_environ
#elif !defined(Q_OS_WIN)
diff --git a/src/corelib/io/qprocess_unix.cpp b/src/corelib/io/qprocess_unix.cpp
index 8c5589538d..1d425653a3 100644
--- a/src/corelib/io/qprocess_unix.cpp
+++ b/src/corelib/io/qprocess_unix.cpp
@@ -322,7 +322,7 @@ QT_END_INCLUDE_NAMESPACE
QProcessEnvironment QProcessEnvironment::systemEnvironment()
{
QProcessEnvironment env;
-#if !defined(Q_OS_IOS)
+#if !defined(QT_PLATFORM_UIKIT)
const char *entry;
for (int count = 0; (entry = environ[count]); ++count) {
const char *equal = strchr(entry, '=');
diff --git a/src/corelib/io/qprocess_win.cpp b/src/corelib/io/qprocess_win.cpp
index 96b39efe3a..8579db1694 100644
--- a/src/corelib/io/qprocess_win.cpp
+++ b/src/corelib/io/qprocess_win.cpp
@@ -867,13 +867,15 @@ bool QProcessPrivate::startDetached(const QString &program, const QStringList &a
bool success = false;
PROCESS_INFORMATION pinfo;
+ DWORD dwCreationFlags = (GetConsoleWindow() ? 0 : CREATE_NO_WINDOW);
+ dwCreationFlags |= CREATE_UNICODE_ENVIRONMENT;
STARTUPINFOW startupInfo = { sizeof( STARTUPINFO ), 0, 0, 0,
(ulong)CW_USEDEFAULT, (ulong)CW_USEDEFAULT,
(ulong)CW_USEDEFAULT, (ulong)CW_USEDEFAULT,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0
};
success = CreateProcess(0, (wchar_t*)args.utf16(),
- 0, 0, FALSE, CREATE_UNICODE_ENVIRONMENT | CREATE_NEW_CONSOLE, 0,
+ 0, 0, FALSE, dwCreationFlags, 0,
workingDir.isEmpty() ? 0 : (wchar_t*)workingDir.utf16(),
&startupInfo, &pinfo);
diff --git a/src/corelib/io/qprocess_wince.cpp b/src/corelib/io/qprocess_wince.cpp
deleted file mode 100644
index 824a6158dc..0000000000
--- a/src/corelib/io/qprocess_wince.cpp
+++ /dev/null
@@ -1,308 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qprocess.h"
-#include "qprocess_p.h"
-
-#include <qdir.h>
-#include <qfileinfo.h>
-#include <qregexp.h>
-#include <qtimer.h>
-#include <qwineventnotifier.h>
-#include <qdebug.h>
-#include <private/qthread_p.h>
-
-#ifndef QT_NO_PROCESS
-
-QT_BEGIN_NAMESPACE
-
-//#define QPROCESS_DEBUG
-
-void QProcessPrivate::destroyPipe(Q_PIPE pipe[2])
-{
- Q_UNUSED(pipe);
-}
-
-void QProcessPrivate::closeChannel(Channel *channel)
-{
- Q_UNUSED(channel);
-}
-
-static QString qt_create_commandline(const QString &program, const QStringList &arguments)
-{
- QString args;
- if (!program.isEmpty()) {
- QString programName = program;
- if (!programName.startsWith(QLatin1Char('\"')) && !programName.endsWith(QLatin1Char('\"')) && programName.contains(QLatin1Char(' ')))
- programName = QLatin1Char('\"') + programName + QLatin1Char('\"');
- programName.replace(QLatin1Char('/'), QLatin1Char('\\'));
-
- // add the prgram as the first arg ... it works better
- args = programName + QLatin1Char(' ');
- }
-
- for (int i=0; i<arguments.size(); ++i) {
- QString tmp = arguments.at(i);
- // Quotes are escaped and their preceding backslashes are doubled.
- tmp.replace(QRegExp(QLatin1String("(\\\\*)\"")), QLatin1String("\\1\\1\\\""));
- if (tmp.isEmpty() || tmp.contains(QLatin1Char(' ')) || tmp.contains(QLatin1Char('\t'))) {
- // The argument must not end with a \ since this would be interpreted
- // as escaping the quote -- rather put the \ behind the quote: e.g.
- // rather use "foo"\ than "foo\"
- int i = tmp.length();
- while (i > 0 && tmp.at(i - 1) == QLatin1Char('\\'))
- --i;
- tmp.insert(i, QLatin1Char('"'));
- tmp.prepend(QLatin1Char('"'));
- }
- args += QLatin1Char(' ') + tmp;
- }
- return args;
-}
-
-QProcessEnvironment QProcessEnvironment::systemEnvironment()
-{
- QProcessEnvironment env;
- return env;
-}
-
-void QProcessPrivate::startProcess()
-{
- Q_Q(QProcess);
-
- bool success = false;
-
- if (pid) {
- CloseHandle(pid->hThread);
- CloseHandle(pid->hProcess);
- delete pid;
- pid = 0;
- }
- pid = new PROCESS_INFORMATION;
- memset(pid, 0, sizeof(PROCESS_INFORMATION));
-
- q->setProcessState(QProcess::Starting);
-
- QString args = qt_create_commandline(QString(), arguments);
- if (!nativeArguments.isEmpty()) {
- if (!args.isEmpty())
- args += QLatin1Char(' ');
- args += nativeArguments;
- }
-
-#if defined QPROCESS_DEBUG
- qDebug("Creating process");
- qDebug(" program : [%s]", program.toLatin1().constData());
- qDebug(" args : %s", args.toLatin1().constData());
- qDebug(" pass environment : %s", environment.isEmpty() ? "no" : "yes");
-#endif
-
- QString fullPathProgram = program;
- if (!QDir::isAbsolutePath(fullPathProgram))
- fullPathProgram = QFileInfo(fullPathProgram).absoluteFilePath();
- fullPathProgram.replace(QLatin1Char('/'), QLatin1Char('\\'));
- success = CreateProcess((wchar_t*)fullPathProgram.utf16(),
- (wchar_t*)args.utf16(),
- 0, 0, false, 0, 0, 0, 0, pid);
-
- if (!success) {
- cleanup();
- setErrorAndEmit(QProcess::FailedToStart);
- q->setProcessState(QProcess::NotRunning);
- return;
- }
-
- q->setProcessState(QProcess::Running);
- // User can call kill()/terminate() from the stateChanged() slot
- // so check before proceeding
- if (!pid)
- return;
-
- if (threadData->hasEventDispatcher()) {
- processFinishedNotifier = new QWinEventNotifier(pid->hProcess, q);
- QObject::connect(processFinishedNotifier, SIGNAL(activated(HANDLE)), q, SLOT(_q_processDied()));
- processFinishedNotifier->setEnabled(true);
- }
-
- // give the process a chance to start ...
- Sleep(20);
- _q_startupNotification();
-}
-
-bool QProcessPrivate::processStarted(QString * /*errorMessage*/)
-{
- return processState == QProcess::Running;
-}
-
-qint64 QProcessPrivate::bytesAvailableInChannel(const Channel *) const
-{
- return 0;
-}
-
-qint64 QProcessPrivate::readFromChannel(const Channel *, char *data, qint64 maxlen)
-{
- return -1;
-}
-
-static BOOL QT_WIN_CALLBACK qt_terminateApp(HWND hwnd, LPARAM procId)
-{
- DWORD currentProcId = 0;
- GetWindowThreadProcessId(hwnd, &currentProcId);
- if (currentProcId == (DWORD)procId)
- PostMessage(hwnd, WM_CLOSE, 0, 0);
-
- return TRUE;
-}
-
-void QProcessPrivate::terminateProcess()
-{
- if (pid) {
- EnumWindows(qt_terminateApp, (LPARAM)pid->dwProcessId);
- PostThreadMessage(pid->dwThreadId, WM_CLOSE, 0, 0);
- }
-}
-
-void QProcessPrivate::killProcess()
-{
- if (pid)
- TerminateProcess(pid->hProcess, 0xf291);
-}
-
-bool QProcessPrivate::waitForStarted(int)
-{
- Q_Q(QProcess);
-
- if (processStarted())
- return true;
-
- if (processError == QProcess::FailedToStart)
- return false;
-
- setError(QProcess::Timedout);
- return false;
-}
-
-bool QProcessPrivate::drainOutputPipes()
-{
- return true;
-}
-
-bool QProcessPrivate::waitForReadyRead(int msecs)
-{
- return false;
-}
-
-bool QProcessPrivate::waitForBytesWritten(int msecs)
-{
- return false;
-}
-
-bool QProcessPrivate::waitForFinished(int msecs)
-{
- Q_Q(QProcess);
-#if defined QPROCESS_DEBUG
- qDebug("QProcessPrivate::waitForFinished(%d)", msecs);
-#endif
-
- if (!pid)
- return true;
-
- if (WaitForSingleObject(pid->hProcess, msecs == -1 ? INFINITE : msecs) == WAIT_OBJECT_0) {
- _q_processDied();
- return true;
- }
-
- setError(QProcess::Timedout);
- return false;
-}
-
-void QProcessPrivate::findExitCode()
-{
- DWORD theExitCode;
- if (GetExitCodeProcess(pid->hProcess, &theExitCode)) {
- exitCode = theExitCode;
- //### for now we assume a crash if exit code is less than -1 or the magic number
- crashed = (exitCode == 0xf291 || (int)exitCode < 0);
- }
-}
-
-void QProcessPrivate::flushPipeWriter()
-{
-}
-
-qint64 QProcessPrivate::pipeWriterBytesToWrite() const
-{
- return 0;
-}
-
-bool QProcessPrivate::writeToStdin()
-{
- return false;
-}
-
-bool QProcessPrivate::startDetached(const QString &program, const QStringList &arguments, const QString &workingDir, qint64 *pid)
-{
- Q_UNUSED(workingDir);
- QString args = qt_create_commandline(QString(), arguments);
-
- bool success = false;
-
- PROCESS_INFORMATION pinfo;
-
- QString fullPathProgram = program;
- if (!QDir::isAbsolutePath(fullPathProgram))
- fullPathProgram.prepend(QDir::currentPath().append(QLatin1Char('/')));
- fullPathProgram.replace(QLatin1Char('/'), QLatin1Char('\\'));
- success = CreateProcess((wchar_t*)fullPathProgram.utf16(),
- (wchar_t*)args.utf16(),
- 0, 0, false, CREATE_NEW_CONSOLE, 0, 0, 0, &pinfo);
-
- if (success) {
- CloseHandle(pinfo.hThread);
- CloseHandle(pinfo.hProcess);
- if (pid)
- *pid = pinfo.dwProcessId;
- }
-
- return success;
-}
-
-QT_END_NAMESPACE
-
-#endif // QT_NO_PROCESS
diff --git a/src/corelib/io/qresource.cpp b/src/corelib/io/qresource.cpp
index 96957ac11d..7fe3753da4 100644
--- a/src/corelib/io/qresource.cpp
+++ b/src/corelib/io/qresource.cpp
@@ -303,12 +303,12 @@ QResourcePrivate::ensureInitialized() const
if(!that->absoluteFilePath.startsWith(QLatin1Char(':')))
that->absoluteFilePath.prepend(QLatin1Char(':'));
- QString path = fileName;
+ QStringRef path(&fileName);
if(path.startsWith(QLatin1Char(':')))
path = path.mid(1);
if(path.startsWith(QLatin1Char('/'))) {
- that->load(path);
+ that->load(path.toString());
} else {
QMutexLocker lock(resourceMutex());
QStringList searchPaths = *resourceSearchPaths();
diff --git a/src/corelib/io/qsettings.cpp b/src/corelib/io/qsettings.cpp
index 0e5d014c30..856108e417 100644
--- a/src/corelib/io/qsettings.cpp
+++ b/src/corelib/io/qsettings.cpp
@@ -81,7 +81,6 @@
#include <stdlib.h>
#ifdef Q_OS_WIN // for homedirpath reading from registry
-# include <private/qsystemlibrary_p.h>
# include <qt_windows.h>
# ifndef Q_OS_WINRT
# include <shlobj.h>
@@ -110,7 +109,7 @@ using namespace ABI::Windows::Storage;
#define Q_XDG_PLATFORM
#endif
-#if !defined(QT_NO_STANDARDPATHS) && (defined(Q_XDG_PLATFORM) || defined(Q_OS_IOS))
+#if !defined(QT_NO_STANDARDPATHS) && (defined(Q_XDG_PLATFORM) || defined(QT_PLATFORM_UIKIT))
#define QSETTINGS_USE_QSTANDARDPATHS
#endif
@@ -966,21 +965,12 @@ static QString windowsConfigPath(int type)
if (result.isEmpty()) {
switch (type) {
-#ifndef Q_OS_WINCE
case CSIDL_COMMON_APPDATA:
result = QLatin1String("C:\\temp\\qt-common");
break;
case CSIDL_APPDATA:
result = QLatin1String("C:\\temp\\qt-user");
break;
-#else
- case CSIDL_COMMON_APPDATA:
- result = QLatin1String("\\Temp\\qt-common");
- break;
- case CSIDL_APPDATA:
- result = QLatin1String("\\Temp\\qt-user");
- break;
-#endif
default:
;
}
diff --git a/src/corelib/io/qsettings_mac.cpp b/src/corelib/io/qsettings_mac.cpp
index d73cc4d298..7f857a77a4 100644
--- a/src/corelib/io/qsettings_mac.cpp
+++ b/src/corelib/io/qsettings_mac.cpp
@@ -181,7 +181,7 @@ static QCFType<CFPropertyListRef> macValue(const QVariant &value)
QDateTime dt = value.toDateTime();
if (dt.timeSpec() == Qt::LocalTime) {
QDateTime reference;
- reference.setTime_t((uint)kCFAbsoluteTimeIntervalSince1970);
+ reference.setSecsSinceEpoch(qint64(kCFAbsoluteTimeIntervalSince1970));
result = CFDateCreate(kCFAllocatorDefault, CFAbsoluteTime(reference.secsTo(dt)));
} else {
goto string_case;
@@ -293,7 +293,7 @@ static QVariant qtValue(CFPropertyListRef cfvalue)
return map;
} else if (typeId == CFDateGetTypeID()) {
QDateTime dt;
- dt.setTime_t((uint)kCFAbsoluteTimeIntervalSince1970);
+ dt.setSecsSinceEpoch(qint64(kCFAbsoluteTimeIntervalSince1970));
return dt.addSecs((int)CFDateGetAbsoluteTime(static_cast<CFDateRef>(cfvalue)));
}
return QVariant();
@@ -541,31 +541,7 @@ void QMacSettingsPrivate::sync()
domains[i].userName, hostNames[j]);
// only report failures for the primary file (the one we write to)
if (!ok && i == 0 && hostNames[j] == hostName && status == QSettings::NoError) {
-#if 1
- if (QSysInfo::macVersion() < QSysInfo::MV_10_7) {
- // work around what seems to be a bug in CFPreferences:
- // don't report an error if there are no preferences for the application
- QCFType<CFArrayRef> appIds = CFPreferencesCopyApplicationList(domains[i].userName,
- hostNames[j]);
-
- // iterate through all the applications and see if we're there
- CFIndex size = CFArrayGetCount(appIds);
- for (CFIndex k = 0; k < size; ++k) {
- const void *cfvalue = CFArrayGetValueAtIndex(appIds, k);
- if (CFGetTypeID(cfvalue) == CFStringGetTypeID()) {
- if (CFStringCompare(static_cast<CFStringRef>(cfvalue),
- domains[i].applicationOrSuiteId,
- kCFCompareCaseInsensitive) == kCFCompareEqualTo) {
- setStatus(QSettings::AccessError);
- break;
- }
- }
- }
- } else
-#endif
- {
- setStatus(QSettings::AccessError);
- }
+ setStatus(QSettings::AccessError);
}
}
}
diff --git a/src/corelib/io/qsettings_win.cpp b/src/corelib/io/qsettings_win.cpp
index 05ed51e999..7c6b782acd 100644
--- a/src/corelib/io/qsettings_win.cpp
+++ b/src/corelib/io/qsettings_win.cpp
@@ -609,16 +609,12 @@ HKEY QWinSettingsPrivate::writeHandle() const
QWinSettingsPrivate::~QWinSettingsPrivate()
{
if (deleteWriteHandleOnExit && writeHandle() != 0) {
-#if defined(Q_OS_WINCE)
- remove(regList.at(0).key());
-#else
QString emptyKey;
DWORD res = RegDeleteKey(writeHandle(), reinterpret_cast<const wchar_t *>(emptyKey.utf16()));
if (res != ERROR_SUCCESS) {
qWarning("QSettings: Failed to delete key \"%s\": %s",
regList.at(0).key().toLatin1().data(), errorCodeToString(res).toLatin1().data());
}
-#endif
}
for (int i = 0; i < regList.size(); ++i)
@@ -660,10 +656,6 @@ void QWinSettingsPrivate::remove(const QString &uKey)
}
}
} else {
-#if defined(Q_OS_WINCE)
- // For WinCE always Close the handle first.
- RegCloseKey(handle);
-#endif
res = RegDeleteKey(writeHandle(), reinterpret_cast<const wchar_t *>(rKey.utf16()));
if (res != ERROR_SUCCESS) {
diff --git a/src/corelib/io/qstandardpaths_mac.mm b/src/corelib/io/qstandardpaths_mac.mm
index f08a6dac53..dc3d7737b6 100644
--- a/src/corelib/io/qstandardpaths_mac.mm
+++ b/src/corelib/io/qstandardpaths_mac.mm
@@ -117,7 +117,7 @@ static QString baseWritableLocation(QStandardPaths::StandardLocation type,
case QStandardPaths::TempLocation:
path = QDir::tempPath();
break;
-#ifdef Q_OS_IOS
+#if defined(QT_PLATFORM_UIKIT)
// These locations point to non-existing write-protected paths. Use sensible fallbacks.
case QStandardPaths::MusicLocation:
path = pathForDirectory(NSDocumentDirectory, mask) + QLatin1String("/Music");
@@ -204,7 +204,7 @@ QStringList QStandardPaths::standardLocations(StandardLocation type)
{
QStringList dirs;
-#ifdef Q_OS_IOS
+#if defined(QT_PLATFORM_UIKIT)
if (type == PicturesLocation)
dirs << writableLocation(PicturesLocation) << QLatin1String("assets-library://");
#endif
diff --git a/src/corelib/io/qstandardpaths_unix.cpp b/src/corelib/io/qstandardpaths_unix.cpp
index bcbc9664ef..0561e5833f 100644
--- a/src/corelib/io/qstandardpaths_unix.cpp
+++ b/src/corelib/io/qstandardpaths_unix.cpp
@@ -223,7 +223,7 @@ QString QStandardPaths::writableLocation(StandardLocation type)
if (!value.isEmpty()) {
// value can start with $HOME
if (value.startsWith(QLatin1String("$HOME")))
- value = QDir::homePath() + value.mid(5);
+ value = QDir::homePath() + value.midRef(5);
if (value.length() > 1 && value.endsWith(QLatin1Char('/')))
value.chop(1);
return value;
diff --git a/src/corelib/io/qstandardpaths_win.cpp b/src/corelib/io/qstandardpaths_win.cpp
index 9bd5a9e3b6..38c63553ea 100644
--- a/src/corelib/io/qstandardpaths_win.cpp
+++ b/src/corelib/io/qstandardpaths_win.cpp
@@ -51,13 +51,7 @@ const GUID qCLSID_FOLDERID_Downloads = { 0x374de290, 0x123f, 0x4565, { 0x91, 0x6
#include <qt_windows.h>
#include <shlobj.h>
-#if !defined(Q_OS_WINCE)
-# include <intshcut.h>
-#else
-# if !defined(STANDARDSHELL_UI_MODEL)
-# include <winx.h>
-# endif
-#endif
+#include <intshcut.h>
#ifndef CSIDL_MYMUSIC
#define CSIDL_MYMUSIC 13
@@ -117,7 +111,6 @@ static inline void appendTestMode(QString &path)
// Map QStandardPaths::StandardLocation to CLSID of SHGetSpecialFolderPath()
static int writableSpecialFolderClsid(QStandardPaths::StandardLocation type)
{
-#ifndef Q_OS_WINCE
static const int clsids[] = {
CSIDL_DESKTOPDIRECTORY, // DesktopLocation
CSIDL_PERSONAL, // DocumentsLocation
@@ -137,27 +130,6 @@ static int writableSpecialFolderClsid(QStandardPaths::StandardLocation type)
CSIDL_APPDATA, // AppDataLocation ("Roaming" path)
CSIDL_LOCAL_APPDATA, // AppConfigLocation ("Local" path)
};
-#else // !Q_OS_WINCE
- static const int clsids[] = {
- CSIDL_DESKTOPDIRECTORY, // DesktopLocation
- CSIDL_PERSONAL, // DocumentsLocation
- CSIDL_FONTS, // FontsLocation
- CSIDL_PROGRAMS, // ApplicationsLocation
- CSIDL_MYMUSIC, // MusicLocation
- CSIDL_MYVIDEO, // MoviesLocation
- CSIDL_MYPICTURES, // PicturesLocation
- -1, -1, // TempLocation/HomeLocation
- CSIDL_APPDATA, // AppLocalDataLocation, AppLocalDataLocation = DataLocation
- -1, // CacheLocation
- CSIDL_APPDATA, // GenericDataLocation
- -1, // RuntimeLocation
- CSIDL_APPDATA, // ConfigLocation
- -1, -1, // DownloadLocation/GenericCacheLocation
- CSIDL_APPDATA, // GenericConfigLocation
- CSIDL_APPDATA, // AppDataLocation
- CSIDL_APPDATA, // AppConfigLocation
- };
-#endif // Q_OS_WINCE
Q_STATIC_ASSERT(sizeof(clsids) / sizeof(clsids[0]) == size_t(QStandardPaths::AppConfigLocation + 1));
return size_t(type) < sizeof(clsids) / sizeof(clsids[0]) ? clsids[type] : -1;
@@ -183,7 +155,6 @@ static QString sHGetSpecialFolderPath(int clsid, QStandardPaths::StandardLocatio
static QString sHGetKnownFolderPath(const GUID &clsid, QStandardPaths::StandardLocation type, bool warn = false)
{
QString result;
-#ifndef Q_OS_WINCE
typedef HRESULT (WINAPI *GetKnownFolderPath)(const GUID&, DWORD, HANDLE, LPWSTR*);
static const GetKnownFolderPath sHGetKnownFolderPath = // Vista onwards.
@@ -199,11 +170,6 @@ static QString sHGetKnownFolderPath(const GUID &clsid, QStandardPaths::StandardL
qPrintable(displayName(type)));
}
}
-#else // !Q_OS_WINCE
- Q_UNUSED(clsid)
- Q_UNUSED(type)
- Q_UNUSED(warn)
-#endif
return result;
}
@@ -266,7 +232,6 @@ QStringList QStandardPaths::standardLocations(StandardLocation type)
dirs.append(localDir);
// type-specific handling goes here
-#ifndef Q_OS_WINCE
if (isConfigLocation(type)) {
QString programData = sHGetSpecialFolderPath(CSIDL_COMMON_APPDATA, type);
if (!programData.isEmpty()) {
@@ -274,12 +239,11 @@ QStringList QStandardPaths::standardLocations(StandardLocation type)
appendOrganizationAndApp(programData);
dirs.append(programData);
}
-# ifndef QT_BOOTSTRAPPED
+#ifndef QT_BOOTSTRAPPED
dirs.append(QCoreApplication::applicationDirPath());
dirs.append(QCoreApplication::applicationDirPath() + QLatin1String("/data"));
-# endif // !QT_BOOTSTRAPPED
+#endif // !QT_BOOTSTRAPPED
} // isConfigLocation()
-#endif // !Q_OS_WINCE
return dirs;
}
diff --git a/src/corelib/io/qstorageinfo_p.h b/src/corelib/io/qstorageinfo_p.h
index 744653ea42..a14fa8480a 100644
--- a/src/corelib/io/qstorageinfo_p.h
+++ b/src/corelib/io/qstorageinfo_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtCore/private/qglobal_p.h>
#include "qstorageinfo.h"
QT_BEGIN_NAMESPACE
@@ -70,7 +71,7 @@ public:
static QStorageInfo root();
protected:
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
+#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
void retrieveVolumeInfo();
void retrieveDiskFreeSpace();
#elif defined(Q_OS_MAC)
diff --git a/src/corelib/io/qtemporaryfile.cpp b/src/corelib/io/qtemporaryfile.cpp
index 0b0446a37e..c430c7714a 100644
--- a/src/corelib/io/qtemporaryfile.cpp
+++ b/src/corelib/io/qtemporaryfile.cpp
@@ -404,7 +404,12 @@ bool QTemporaryFileEngine::close()
//************* QTemporaryFilePrivate
-QTemporaryFilePrivate::QTemporaryFilePrivate() : autoRemove(true)
+QTemporaryFilePrivate::QTemporaryFilePrivate()
+{
+}
+
+QTemporaryFilePrivate::QTemporaryFilePrivate(const QString &templateNameIn)
+ : templateName(templateNameIn)
{
}
@@ -498,15 +503,11 @@ QString QTemporaryFilePrivate::defaultTemplateName()
QTemporaryFile::QTemporaryFile()
: QFile(*new QTemporaryFilePrivate)
{
- Q_D(QTemporaryFile);
- d->templateName = QTemporaryFilePrivate::defaultTemplateName();
}
QTemporaryFile::QTemporaryFile(const QString &templateName)
- : QFile(*new QTemporaryFilePrivate)
+ : QFile(*new QTemporaryFilePrivate(templateName))
{
- Q_D(QTemporaryFile);
- d->templateName = templateName;
}
#else
@@ -519,10 +520,8 @@ QTemporaryFile::QTemporaryFile(const QString &templateName)
\sa setFileTemplate(), QDir::tempPath()
*/
QTemporaryFile::QTemporaryFile()
- : QFile(*new QTemporaryFilePrivate, 0)
+ : QTemporaryFile(nullptr)
{
- Q_D(QTemporaryFile);
- d->templateName = QTemporaryFilePrivate::defaultTemplateName();
}
/*!
@@ -540,10 +539,8 @@ QTemporaryFile::QTemporaryFile()
\sa open(), fileTemplate()
*/
QTemporaryFile::QTemporaryFile(const QString &templateName)
- : QFile(*new QTemporaryFilePrivate, 0)
+ : QTemporaryFile(templateName, nullptr)
{
- Q_D(QTemporaryFile);
- d->templateName = templateName;
}
/*!
@@ -557,8 +554,6 @@ QTemporaryFile::QTemporaryFile(const QString &templateName)
QTemporaryFile::QTemporaryFile(QObject *parent)
: QFile(*new QTemporaryFilePrivate, parent)
{
- Q_D(QTemporaryFile);
- d->templateName = QTemporaryFilePrivate::defaultTemplateName();
}
/*!
@@ -577,10 +572,8 @@ QTemporaryFile::QTemporaryFile(QObject *parent)
\sa open(), fileTemplate()
*/
QTemporaryFile::QTemporaryFile(const QString &templateName, QObject *parent)
- : QFile(*new QTemporaryFilePrivate, parent)
+ : QFile(*new QTemporaryFilePrivate(templateName), parent)
{
- Q_D(QTemporaryFile);
- d->templateName = templateName;
}
#endif
diff --git a/src/corelib/io/qtemporaryfile_p.h b/src/corelib/io/qtemporaryfile_p.h
index 58cc318ffd..d057603034 100644
--- a/src/corelib/io/qtemporaryfile_p.h
+++ b/src/corelib/io/qtemporaryfile_p.h
@@ -67,13 +67,14 @@ class QTemporaryFilePrivate : public QFilePrivate
protected:
QTemporaryFilePrivate();
+ explicit QTemporaryFilePrivate(const QString &templateNameIn);
~QTemporaryFilePrivate();
QAbstractFileEngine *engine() const;
void resetFileEngine() const;
- bool autoRemove;
- QString templateName;
+ bool autoRemove = true;
+ QString templateName = defaultTemplateName();
static QString defaultTemplateName();
diff --git a/src/corelib/io/qtextstream.cpp b/src/corelib/io/qtextstream.cpp
index 27b7570226..b8db23329a 100644
--- a/src/corelib/io/qtextstream.cpp
+++ b/src/corelib/io/qtextstream.cpp
@@ -231,9 +231,7 @@ static const int QTEXTSTREAM_BUFFERSIZE = 16384;
#include "qnumeric.h"
#include "qvarlengtharray.h"
-#ifndef Q_OS_WINCE
#include <locale.h>
-#endif
#include "private/qlocale_p.h"
#include <stdlib.h>
diff --git a/src/corelib/io/qtextstream_p.h b/src/corelib/io/qtextstream_p.h
index 684cff6aa1..a642beddc4 100644
--- a/src/corelib/io/qtextstream_p.h
+++ b/src/corelib/io/qtextstream_p.h
@@ -52,6 +52,7 @@
// We mean it.
//
+#include <QtCore/private/qglobal_p.h>
#include "qtextstream.h"
#ifndef QT_NO_TEXTCODEC
#include "qtextcodec.h"
diff --git a/src/corelib/io/qtldurl_p.h b/src/corelib/io/qtldurl_p.h
index b1fde0c700..b9fbdebbc5 100644
--- a/src/corelib/io/qtldurl_p.h
+++ b/src/corelib/io/qtldurl_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtCore/private/qglobal_p.h>
#include "QtCore/qurl.h"
#include "QtCore/qstring.h"
diff --git a/src/corelib/io/qurl.cpp b/src/corelib/io/qurl.cpp
index fd2127bce3..71a0228eeb 100644
--- a/src/corelib/io/qurl.cpp
+++ b/src/corelib/io/qurl.cpp
@@ -413,9 +413,6 @@
#include "qtldurl_p.h"
#include "private/qipaddress_p.h"
#include "qurlquery.h"
-#if defined(Q_OS_WINCE_WM)
-#pragma optimize("g", off)
-#endif
QT_BEGIN_NAMESPACE
extern QString qt_normalizePathSegments(const QString &name, bool allowUncPaths); // qdir.cpp
@@ -3456,33 +3453,6 @@ QByteArray QUrl::toPercentEncoding(const QString &input, const QByteArray &exclu
return input.toUtf8().toPercentEncoding(exclude, include);
}
-/*! \fn QUrl QUrl::fromCFURL(CFURLRef url)
- \since 5.2
-
- Constructs a QUrl containing a copy of the CFURL \a url.
-*/
-
-/*! \fn CFURLRef QUrl::toCFURL() const
- \since 5.2
-
- Creates a CFURL from a QUrl. The caller owns the CFURL and is
- responsible for releasing it.
-*/
-
-/*!
- \fn QUrl QUrl::fromNSURL(const NSURL *url)
- \since 5.2
-
- Constructs a QUrl containing a copy of the NSURL \a url.
-*/
-
-/*!
- \fn NSURL* QUrl::toNSURL() const
- \since 5.2
-
- Creates a NSURL from a QUrl. The NSURL is autoreleased.
-*/
-
/*!
\internal
\since 5.0
@@ -3816,13 +3786,13 @@ QUrl QUrl::fromLocalFile(const QString &localFile)
} else if (deslashified.startsWith(QLatin1String("//"))) {
// magic for shared drive on windows
int indexOfPath = deslashified.indexOf(QLatin1Char('/'), 2);
- QString hostSpec = deslashified.mid(2, indexOfPath - 2);
+ QStringRef hostSpec = deslashified.midRef(2, indexOfPath - 2);
// Check for Windows-specific WebDAV specification: "//host@SSL/path".
if (hostSpec.endsWith(webDavSslTag(), Qt::CaseInsensitive)) {
- hostSpec.chop(4);
+ hostSpec.truncate(hostSpec.size() - 4);
scheme = webDavScheme();
}
- url.setHost(hostSpec);
+ url.setHost(hostSpec.toString());
if (indexOfPath > 2)
deslashified = deslashified.right(deslashified.length() - indexOfPath);
@@ -4287,8 +4257,8 @@ QUrl QUrl::fromUserInput(const QString &userInput)
if (urlPrepended.isValid() && (!urlPrepended.host().isEmpty() || !urlPrepended.path().isEmpty()))
{
int dotIndex = trimmedString.indexOf(QLatin1Char('.'));
- const QString hostscheme = trimmedString.left(dotIndex).toLower();
- if (hostscheme == ftpScheme())
+ const QStringRef hostscheme = trimmedString.leftRef(dotIndex);
+ if (hostscheme.compare(ftpScheme(), Qt::CaseInsensitive) == 0)
urlPrepended.setScheme(ftpScheme());
return adjustFtpPath(urlPrepended);
}
diff --git a/src/corelib/io/qurl.h b/src/corelib/io/qurl.h
index 947b3bbb55..bce271fcb1 100644
--- a/src/corelib/io/qurl.h
+++ b/src/corelib/io/qurl.h
@@ -48,11 +48,9 @@
#include <QtCore/qpair.h>
#include <QtCore/qglobal.h>
-#ifdef Q_OS_MAC
+#if defined(Q_OS_DARWIN) || defined(Q_QDOC)
Q_FORWARD_DECLARE_CF_TYPE(CFURL);
-# ifdef __OBJC__
Q_FORWARD_DECLARE_OBJC_CLASS(NSURL);
-# endif
#endif
QT_BEGIN_NAMESPACE
@@ -164,6 +162,12 @@ public:
};
Q_DECLARE_FLAGS(ComponentFormattingOptions, ComponentFormattingOption)
#ifdef Q_QDOC
+private:
+ // We need to let qdoc think that FormattingOptions is a normal QFlags, but
+ // it needs to be a QUrlTwoFlags for compiling default arguments of somme functions.
+ template<typename T> struct QFlags : QUrlTwoFlags<T, ComponentFormattingOption>
+ { using QUrlTwoFlags<T, ComponentFormattingOption>::QUrlTwoFlags; };
+public:
Q_DECLARE_FLAGS(FormattingOptions, UrlFormattingOption)
#else
typedef QUrlTwoFlags<UrlFormattingOption, ComponentFormattingOption> FormattingOptions;
@@ -271,13 +275,11 @@ public:
static QByteArray toPercentEncoding(const QString &,
const QByteArray &exclude = QByteArray(),
const QByteArray &include = QByteArray());
-#if defined(Q_OS_MAC) || defined(Q_QDOC)
+#if defined(Q_OS_DARWIN) || defined(Q_QDOC)
static QUrl fromCFURL(CFURLRef url);
CFURLRef toCFURL() const Q_DECL_CF_RETURNS_RETAINED;
-# if defined(__OBJC__) || defined(Q_QDOC)
static QUrl fromNSURL(const NSURL *url);
NSURL *toNSURL() const Q_DECL_NS_RETURNS_AUTORELEASED;
-# endif
#endif
#if QT_DEPRECATED_SINCE(5,0)
@@ -372,6 +374,7 @@ Q_DECLARE_SHARED(QUrl)
Q_DECLARE_OPERATORS_FOR_FLAGS(QUrl::ComponentFormattingOptions)
//Q_DECLARE_OPERATORS_FOR_FLAGS(QUrl::FormattingOptions)
+#ifndef Q_QDOC
Q_DECL_CONSTEXPR inline QUrl::FormattingOptions operator|(QUrl::UrlFormattingOption f1, QUrl::UrlFormattingOption f2)
{ return QUrl::FormattingOptions(f1) | f2; }
Q_DECL_CONSTEXPR inline QUrl::FormattingOptions operator|(QUrl::UrlFormattingOption f1, QUrl::FormattingOptions f2)
@@ -399,6 +402,7 @@ Q_DECL_CONSTEXPR inline QUrl::FormattingOptions operator|(QUrl::ComponentFormatt
//inline QUrl::UrlFormattingOption &operator=(const QUrl::UrlFormattingOption &i, QUrl::ComponentFormattingOptions f)
//{ i = int(f); f; }
+#endif // Q_QDOC
#ifndef QT_NO_DATASTREAM
Q_CORE_EXPORT QDataStream &operator<<(QDataStream &, const QUrl &);
diff --git a/src/corelib/io/qurl_mac.mm b/src/corelib/io/qurl_mac.mm
deleted file mode 100644
index 04d05f1b23..0000000000
--- a/src/corelib/io/qurl_mac.mm
+++ /dev/null
@@ -1,74 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qurl.h"
-
-#ifdef Q_OS_MAC
-#include <Foundation/Foundation.h>
-#endif
-
-QT_BEGIN_NAMESPACE
-
-QUrl QUrl::fromCFURL(CFURLRef url)
-{
- return QUrl(QString::fromCFString(CFURLGetString(url)));
-}
-
-CFURLRef QUrl::toCFURL() const
-{
- CFURLRef url = 0;
- CFStringRef str = toString(FullyEncoded).toCFString();
- if (str) {
- url = CFURLCreateWithString(0, str, 0);
- CFRelease(str);
- }
- return url;
-}
-
-QUrl QUrl::fromNSURL(const NSURL *url)
-{
- return QUrl(QString::fromNSString([url absoluteString]));
-}
-
-NSURL *QUrl::toNSURL() const
-{
- return [NSURL URLWithString:toString(FullyEncoded).toNSString()];
-}
-
-QT_END_NAMESPACE
diff --git a/src/corelib/io/qurl_p.h b/src/corelib/io/qurl_p.h
index 49dcdeb144..cb88cac35e 100644
--- a/src/corelib/io/qurl_p.h
+++ b/src/corelib/io/qurl_p.h
@@ -52,6 +52,7 @@
// We mean it.
//
+#include <QtCore/private/qglobal_p.h>
#include "qurl.h"
QT_BEGIN_NAMESPACE
diff --git a/src/corelib/io/qurltlds_p.h b/src/corelib/io/qurltlds_p.h
index 69d0701faa..2bd5c68c7b 100644
--- a/src/corelib/io/qurltlds_p.h
+++ b/src/corelib/io/qurltlds_p.h
@@ -52,6 +52,8 @@
// We mean it.
//
+#include <QtCore/private/qglobal_p.h>
+
QT_BEGIN_NAMESPACE
// note to maintainer:
diff --git a/src/corelib/io/qwindowspipereader.cpp b/src/corelib/io/qwindowspipereader.cpp
index 15fb276be9..b8df8e8084 100644
--- a/src/corelib/io/qwindowspipereader.cpp
+++ b/src/corelib/io/qwindowspipereader.cpp
@@ -71,21 +71,6 @@ QWindowsPipeReader::QWindowsPipeReader(QObject *parent)
this, &QWindowsPipeReader::emitPendingReadyRead, Qt::QueuedConnection);
}
-bool qt_cancelIo(HANDLE handle, OVERLAPPED *overlapped)
-{
- typedef BOOL (WINAPI *PtrCancelIoEx)(HANDLE, LPOVERLAPPED);
- static PtrCancelIoEx ptrCancelIoEx = 0;
- if (!ptrCancelIoEx) {
- HMODULE kernel32 = GetModuleHandleA("kernel32");
- if (kernel32)
- ptrCancelIoEx = PtrCancelIoEx(GetProcAddress(kernel32, "CancelIoEx"));
- }
- if (ptrCancelIoEx)
- return ptrCancelIoEx(handle, overlapped);
- else
- return CancelIo(handle);
-}
-
QWindowsPipeReader::~QWindowsPipeReader()
{
stop();
@@ -110,7 +95,7 @@ void QWindowsPipeReader::stop()
{
stopped = true;
if (readSequenceStarted) {
- if (!qt_cancelIo(handle, &overlapped)) {
+ if (!CancelIoEx(handle, &overlapped)) {
const DWORD dwError = GetLastError();
if (dwError != ERROR_NOT_FOUND) {
qErrnoWarning(dwError, "QWindowsPipeReader: qt_cancelIo on handle %x failed.",
diff --git a/src/corelib/io/qwindowspipewriter.cpp b/src/corelib/io/qwindowspipewriter.cpp
index b0ca0d979b..3ab2c70c75 100644
--- a/src/corelib/io/qwindowspipewriter.cpp
+++ b/src/corelib/io/qwindowspipewriter.cpp
@@ -42,9 +42,6 @@
QT_BEGIN_NAMESPACE
-extern bool qt_cancelIo(HANDLE handle, OVERLAPPED *overlapped); // from qwindowspipereader.cpp
-
-
QWindowsPipeWriter::Overlapped::Overlapped(QWindowsPipeWriter *pipeWriter)
: pipeWriter(pipeWriter)
{
@@ -211,7 +208,7 @@ void QWindowsPipeWriter::stop()
bytesWrittenPending = false;
pendingBytesWrittenValue = 0;
if (writeSequenceStarted) {
- if (!qt_cancelIo(handle, &overlapped)) {
+ if (!CancelIoEx(handle, &overlapped)) {
const DWORD dwError = GetLastError();
if (dwError != ERROR_NOT_FOUND) {
qErrnoWarning(dwError, "QWindowsPipeWriter: qt_cancelIo on handle %x failed.",
diff --git a/src/corelib/io/qwindowspipewriter_p.h b/src/corelib/io/qwindowspipewriter_p.h
index 3c641670b6..5a0d04855f 100644
--- a/src/corelib/io/qwindowspipewriter_p.h
+++ b/src/corelib/io/qwindowspipewriter_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtCore/private/qglobal_p.h>
#include <qelapsedtimer.h>
#include <qobject.h>
#include <qbytearray.h>
diff --git a/src/corelib/io/qwinoverlappedionotifier_p.h b/src/corelib/io/qwinoverlappedionotifier_p.h
index febdfe310f..276a1d861e 100644
--- a/src/corelib/io/qwinoverlappedionotifier_p.h
+++ b/src/corelib/io/qwinoverlappedionotifier_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtCore/private/qglobal_p.h>
#include <qobject.h>
typedef struct _OVERLAPPED OVERLAPPED;