diff options
author | Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> | 2016-03-23 10:25:46 +0100 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> | 2016-03-30 11:22:47 +0000 |
commit | 7fc2864dc5391096a19c2d5f80695129c24cc303 (patch) | |
tree | cd52ea13882972c24fca1cdd032ecd7e92725df5 /src/corelib/io | |
parent | 04aa760711602d3891d1f7f71e7f27911ff80d97 (diff) |
QtCore: Remove Windows CE.
Remove QSysInfo::WV_CE_5/6 enumeration values, #ifdef sections for Q_OS_WINCE
and wince .pro file clauses in library, examples and tests.
Task-number: QTBUG-51673
Change-Id: Ib63463445f3a26e04d018b193e4655030002f5f9
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
Diffstat (limited to 'src/corelib/io')
-rw-r--r-- | src/corelib/io/io.pri | 32 | ||||
-rw-r--r-- | src/corelib/io/qdir.cpp | 2 | ||||
-rw-r--r-- | src/corelib/io/qfileselector.cpp | 2 | ||||
-rw-r--r-- | src/corelib/io/qfilesystemengine_win.cpp | 182 | ||||
-rw-r--r-- | src/corelib/io/qfilesystemiterator_win.cpp | 2 | ||||
-rw-r--r-- | src/corelib/io/qfilesystemmetadata_p.h | 3 | ||||
-rw-r--r-- | src/corelib/io/qfilesystemwatcher_win.cpp | 10 | ||||
-rw-r--r-- | src/corelib/io/qfsfileengine.cpp | 6 | ||||
-rw-r--r-- | src/corelib/io/qfsfileengine_p.h | 9 | ||||
-rw-r--r-- | src/corelib/io/qfsfileengine_win.cpp | 141 | ||||
-rw-r--r-- | src/corelib/io/qlockfile_win.cpp | 2 | ||||
-rw-r--r-- | src/corelib/io/qprocess.cpp | 14 | ||||
-rw-r--r-- | src/corelib/io/qprocess_wince.cpp | 310 | ||||
-rw-r--r-- | src/corelib/io/qsettings.cpp | 9 | ||||
-rw-r--r-- | src/corelib/io/qsettings_win.cpp | 8 | ||||
-rw-r--r-- | src/corelib/io/qstandardpaths_win.cpp | 42 | ||||
-rw-r--r-- | src/corelib/io/qstorageinfo_p.h | 2 | ||||
-rw-r--r-- | src/corelib/io/qtextstream.cpp | 2 | ||||
-rw-r--r-- | src/corelib/io/qurl.cpp | 3 |
19 files changed, 84 insertions, 697 deletions
diff --git a/src/corelib/io/io.pri b/src/corelib/io/io.pri index 1ae0485840..9d7210fb4f 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 \ diff --git a/src/corelib/io/qdir.cpp b/src/corelib/io/qdir.cpp index 9b9b00f76d..f8070703ee 100644 --- a/src/corelib/io/qdir.cpp +++ b/src/corelib/io/qdir.cpp @@ -2191,7 +2191,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 4ac12fc9ea..7026d3403b 100644 --- a/src/corelib/io/qfileselector.cpp +++ b/src/corelib/io/qfileselector.cpp @@ -369,7 +369,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/qfilesystemengine_win.cpp b/src/corelib/io/qfilesystemengine_win.cpp index 0829bbc6e8..97af142a08 100644 --- a/src/corelib/io/qfilesystemengine_win.cpp +++ b/src/corelib/io/qfilesystemengine_win.cpp @@ -53,13 +53,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> @@ -116,8 +112,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 +138,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 @@ -233,7 +227,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"); @@ -282,7 +275,6 @@ static void resolveLibs() HINSTANCE kernel32 = LoadLibrary(L"kernel32"); if(kernel32) ptrGetVolumePathNamesForVolumeNameW = (PtrGetVolumePathNamesForVolumeNameW)GetProcAddress(kernel32, "GetVolumePathNamesForVolumeNameW"); -#endif } } #endif // QT_NO_LIBRARY @@ -309,14 +301,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 +316,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, @@ -367,17 +359,16 @@ static QString readSymLink(const QFileSystemEntry &link) 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,21 +409,6 @@ 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) @@ -533,7 +509,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 +529,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 +551,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,8 +583,6 @@ 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; @@ -690,12 +654,10 @@ QByteArray fileIdWin8(HANDLE handle) #endif // Q_OS_WINRT return result; } -#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 +673,6 @@ QByteArray QFileSystemEngine::id(const QFileSystemEntry &entry) CloseHandle(handle); } return result; -#else // !Q_OS_WINCE - return entry.nativeFilePath().toLower().toLatin1(); -#endif } //static @@ -882,7 +841,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 ?? DWORD drivesBitmask = ::GetLogicalDrives(); @@ -923,7 +882,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) @@ -947,7 +906,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) @@ -958,7 +916,6 @@ bool QFileSystemEngine::fillMetaData(int fd, QFileSystemMetaData &data, } return false; } -#endif //static bool QFileSystemEngine::fillMetaData(HANDLE fHandle, QFileSystemMetaData &data, @@ -1067,25 +1024,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. @@ -1215,9 +1153,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 @@ -1283,13 +1219,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(); } } } @@ -1302,10 +1233,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); @@ -1313,7 +1240,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); @@ -1341,11 +1267,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; @@ -1358,7 +1280,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; @@ -1371,7 +1293,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); @@ -1387,17 +1309,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()); } @@ -1479,31 +1397,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/qfilesystemiterator_win.cpp b/src/corelib/io/qfilesystemiterator_win.cpp index ba195b2330..9e40a41b4c 100644 --- a/src/corelib/io/qfilesystemiterator_win.cpp +++ b/src/corelib/io/qfilesystemiterator_win.cpp @@ -92,12 +92,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 diff --git a/src/corelib/io/qfilesystemmetadata_p.h b/src/corelib/io/qfilesystemmetadata_p.h index 7135c9b19b..b38188d357 100644 --- a/src/corelib/io/qfilesystemmetadata_p.h +++ b/src/corelib/io/qfilesystemmetadata_p.h @@ -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_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..7a04939cdb 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 } /*! 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 d94a8433a9..1e041ab837 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,10 +549,10 @@ 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) quint32 driveBits = (quint32) GetLogicalDrives() & 0x3ffffff; -#endif +# endif char driveName[] = "A:/"; while (driveBits) { @@ -643,10 +562,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 @@ -654,13 +573,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)); } @@ -671,8 +588,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; @@ -713,24 +630,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; @@ -811,7 +715,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 @@ -819,9 +722,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 { @@ -903,14 +804,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(); @@ -982,10 +881,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/qlockfile_win.cpp b/src/corelib/io/qlockfile_win.cpp index 9062df37da..261363f320 100644 --- a/src/corelib/io/qlockfile_win.cpp +++ b/src/corelib/io/qlockfile_win.cpp @@ -163,7 +163,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/qprocess.cpp b/src/corelib/io/qprocess.cpp index e9c2cabc66..90a7f67c48 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 /* @@ -2016,13 +2013,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)", @@ -2205,7 +2195,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()); @@ -2213,7 +2202,6 @@ void QProcessPrivate::start(QIODevice::OpenMode mode) && processChannelMode != QProcess::MergedChannels) q->setStandardErrorFile(q->nullDevice()); } -#endif q->QIODevice::open(mode); @@ -2573,7 +2561,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(Q_OS_IOS) static char *qt_empty_environ[] = { 0 }; #define environ qt_empty_environ #elif !defined(Q_OS_WIN) diff --git a/src/corelib/io/qprocess_wince.cpp b/src/corelib/io/qprocess_wince.cpp deleted file mode 100644 index 564b3f520d..0000000000 --- a/src/corelib/io/qprocess_wince.cpp +++ /dev/null @@ -1,310 +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, ¤tProcId); - 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; -} - -qint64 QProcessPrivate::writeToStdin(const char *data, qint64 maxlen) -{ - Q_UNUSED(data); - Q_UNUSED(maxlen); - return -1; -} - -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/qsettings.cpp b/src/corelib/io/qsettings.cpp index dcbd69c5e5..8783396bf8 100644 --- a/src/corelib/io/qsettings.cpp +++ b/src/corelib/io/qsettings.cpp @@ -986,21 +986,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_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_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..9dc66f2d69 100644 --- a/src/corelib/io/qstorageinfo_p.h +++ b/src/corelib/io/qstorageinfo_p.h @@ -70,7 +70,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/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/qurl.cpp b/src/corelib/io/qurl.cpp index 18eaea7e21..1e409c105c 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 |