diff options
Diffstat (limited to 'src/corelib')
55 files changed, 155 insertions, 2299 deletions
diff --git a/src/corelib/arch/arch.pri b/src/corelib/arch/arch.pri index ec617386a4..0f7c2b887b 100644 --- a/src/corelib/arch/arch.pri +++ b/src/corelib/arch/arch.pri @@ -1,4 +1,4 @@ -win32|wince:HEADERS += arch/qatomic_msvc.h +win32:HEADERS += arch/qatomic_msvc.h HEADERS += \ arch/qatomic_bootstrap.h \ diff --git a/src/corelib/arch/qatomic_msvc.h b/src/corelib/arch/qatomic_msvc.h index 62d54ded55..5eae2bdc48 100644 --- a/src/corelib/arch/qatomic_msvc.h +++ b/src/corelib/arch/qatomic_msvc.h @@ -45,8 +45,6 @@ //////////////////////////////////////////////////////////////////////////////////////////////////// -#ifndef Q_OS_WINCE - // use compiler intrinsics for all atomic functions # define QT_INTERLOCKED_PREFIX _ # define QT_INTERLOCKED_PROTOTYPE @@ -58,36 +56,6 @@ # define Q_ATOMIC_INT64_IS_SUPPORTED # endif -#else // Q_OS_WINCE - -# if _WIN32_WCE < 0x600 && defined(_X86_) -// For X86 Windows CE, include winbase.h to catch inline functions which -// override the regular definitions inside of coredll.dll. -// Though one could use the original version of Increment/Decrement, others are -// not exported at all. -# include <winbase.h> - -// It's safer to remove the volatile and let the compiler add it as needed. -# define QT_INTERLOCKED_VOLATILE - -# else // _WIN32_WCE >= 0x600 || !_X86_ - -# define QT_INTERLOCKED_PROTOTYPE __cdecl -# define QT_INTERLOCKED_DECLARE_PROTOTYPES - -# if _WIN32_WCE >= 0x600 -# if defined(_X86_) -# define QT_INTERLOCKED_PREFIX _ -# define QT_INTERLOCKED_INTRINSIC -# endif -# else -# define QT_INTERLOCKED_VOLATILE -# endif - -# endif // _WIN32_WCE >= 0x600 || !_X86_ - -#endif // Q_OS_WINCE - //////////////////////////////////////////////////////////////////////////////////////////////////// // Prototype declaration @@ -128,7 +96,7 @@ extern "C" { long QT_INTERLOCKED_PROTOTYPE QT_INTERLOCKED_FUNCTION( Exchange )(long QT_INTERLOCKED_VOLATILE *, long); long QT_INTERLOCKED_PROTOTYPE QT_INTERLOCKED_FUNCTION( ExchangeAdd )(long QT_INTERLOCKED_VOLATILE *, long); -# if !defined(Q_OS_WINCE) && !defined(__i386__) && !defined(_M_IX86) +# if !defined(__i386__) && !defined(_M_IX86) void * QT_INTERLOCKED_FUNCTION( CompareExchangePointer )(void * QT_INTERLOCKED_VOLATILE *, void *, void *); void * QT_INTERLOCKED_FUNCTION( ExchangePointer )(void * QT_INTERLOCKED_VOLATILE *, void *); __int64 QT_INTERLOCKED_FUNCTION( ExchangeAdd64 )(__int64 QT_INTERLOCKED_VOLATILE *, __int64); @@ -165,7 +133,7 @@ extern "C" { # pragma intrinsic (_InterlockedCompareExchange) # pragma intrinsic (_InterlockedExchangeAdd) -# if !defined(Q_OS_WINCE) && !defined(_M_IX86) +# if !defined(_M_IX86) # pragma intrinsic (_InterlockedCompareExchangePointer) # pragma intrinsic (_InterlockedExchangePointer) # pragma intrinsic (_InterlockedExchangeAdd64) @@ -176,7 +144,7 @@ extern "C" { //////////////////////////////////////////////////////////////////////////////////////////////////// // Interlocked* replacement macros -#if defined(Q_OS_WINCE) || defined(__i386__) || defined(_M_IX86) +#if defined(__i386__) || defined(_M_IX86) # define QT_INTERLOCKED_COMPARE_EXCHANGE_POINTER(value, newValue, expectedValue) \ reinterpret_cast<void *>( \ @@ -195,7 +163,7 @@ extern "C" { reinterpret_cast<long QT_INTERLOCKED_VOLATILE *>(value), \ (valueToAdd)) -#else // !defined(Q_OS_WINCE) && !defined(__i386__) && !defined(_M_IX86) +#else // !defined(__i386__) && !defined(_M_IX86) # define QT_INTERLOCKED_COMPARE_EXCHANGE_POINTER(value, newValue, expectedValue) \ QT_INTERLOCKED_FUNCTION(CompareExchangePointer)( \ @@ -213,7 +181,7 @@ extern "C" { reinterpret_cast<qint64 QT_INTERLOCKED_VOLATILE *>(value), \ (valueToAdd)) -#endif // !defined(Q_OS_WINCE) && !defined(__i386__) && !defined(_M_IX86) +#endif // !defined(__i386__) && !defined(_M_IX86) //////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/src/corelib/codecs/qtextcodec.cpp b/src/corelib/codecs/qtextcodec.cpp index edb03af447..5098ac4242 100644 --- a/src/corelib/codecs/qtextcodec.cpp +++ b/src/corelib/codecs/qtextcodec.cpp @@ -132,7 +132,7 @@ bool qTextCodecNameMatch(const char *n, const char *h) } -#if !defined(Q_OS_WIN32) && !defined(Q_OS_WINCE) && !defined(QT_LOCALE_IS_UTF8) +#if !defined(Q_OS_WIN32) && !defined(QT_LOCALE_IS_UTF8) static QTextCodec *checkForCodec(const QByteArray &name) { QTextCodec *c = QTextCodec::codecForName(name); if (!c) { @@ -169,7 +169,7 @@ static QTextCodec *setupLocaleMapper() #if defined(QT_LOCALE_IS_UTF8) locale = QTextCodec::codecForName("UTF-8"); -#elif defined(Q_OS_WIN) || defined(Q_OS_WINCE) +#elif defined(Q_OS_WIN) locale = QTextCodec::codecForName("System"); #else @@ -289,7 +289,7 @@ static void setup() #if !defined(QT_NO_ICONV) (void) new QIconvCodec; #endif -#if defined(Q_OS_WIN32) || defined(Q_OS_WINCE) +#if defined(Q_OS_WIN32) (void) new QWindowsLocalCodec; #endif // Q_OS_WIN32 #endif // !QT_NO_CODECS && !QT_BOOTSTRAPPED diff --git a/src/corelib/codecs/qwindowscodec.cpp b/src/corelib/codecs/qwindowscodec.cpp index 74c2f75d2b..e8f7e6f156 100644 --- a/src/corelib/codecs/qwindowscodec.cpp +++ b/src/corelib/codecs/qwindowscodec.cpp @@ -157,7 +157,7 @@ QString QWindowsLocalCodec::convertToUnicodeCharByChar(const char *chars, int le state->remainingChars = 0; } const char *mb = mbcs; -#if !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#if !defined(Q_OS_WINRT) const char *next = 0; QString s; while ((next = CharNextExA(CP_ACP, mb, 0)) != mb) { diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index 35213f8a4c..f485204f8b 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -64,11 +64,9 @@ # include <exception> #endif -#if !defined(Q_OS_WINCE) -# include <errno.h> -# if defined(Q_CC_MSVC) -# include <crtdbg.h> -# endif +#include <errno.h> +#if defined(Q_CC_MSVC) +# include <crtdbg.h> #endif #ifdef Q_OS_WINRT @@ -1262,7 +1260,7 @@ bool qSharedBuild() Q_DECL_NOTHROW \relates <QtGlobal> Defined on all supported versions of Windows. That is, if - \l Q_OS_WIN32, \l Q_OS_WIN64, \l Q_OS_WINCE or \l Q_OS_WINRT is defined. + \l Q_OS_WIN32, \l Q_OS_WIN64 or \l Q_OS_WINRT is defined. */ /*! @@ -1280,13 +1278,6 @@ bool qSharedBuild() Q_DECL_NOTHROW */ /*! - \macro Q_OS_WINCE - \relates <QtGlobal> - - Defined on Windows CE. -*/ - -/*! \macro Q_OS_WINRT \relates <QtGlobal> @@ -1922,7 +1913,7 @@ QSysInfo::MacVersion QSysInfo::macVersion() } const QSysInfo::MacVersion QSysInfo::MacintoshVersion = QSysInfo::macVersion(); -#elif defined(Q_OS_WIN) || defined(Q_OS_CYGWIN) || defined(Q_OS_WINCE) || defined(Q_OS_WINRT) +#elif defined(Q_OS_WIN) || defined(Q_OS_CYGWIN) || defined(Q_OS_WINRT) QT_BEGIN_INCLUDE_NAMESPACE #include "qt_windows.h" @@ -1975,9 +1966,7 @@ static inline OSVERSIONINFOEX determineWinOsVersion() { OSVERSIONINFOEX result = { sizeof(OSVERSIONINFOEX), 0, 0, 0, 0, {'\0'}, 0, 0, 0, 0, 0}; -#ifndef Q_OS_WINCE #define GetProcAddressA GetProcAddress -#endif // GetModuleHandle is not supported in WinRT and linking to it at load time // will not pass the Windows App Certification Kit... but it exists and is functional, @@ -2048,11 +2037,6 @@ QSysInfo::WinVersion QSysInfo::windowsVersion() const OSVERSIONINFOEX osver = winOsVersion(); if (osver.dwMajorVersion == 0) return QSysInfo::WV_None; -#ifdef Q_OS_WINCE - DWORD qt_cever = 0; - qt_cever = osver.dwMajorVersion * 100; - qt_cever += osver.dwMinorVersion * 10; -#endif switch (osver.dwPlatformId) { case VER_PLATFORM_WIN32s: winver = QSysInfo::WV_32s; @@ -2066,18 +2050,6 @@ QSysInfo::WinVersion QSysInfo::windowsVersion() else winver = QSysInfo::WV_95; break; -#ifdef Q_OS_WINCE - case VER_PLATFORM_WIN32_CE: - if (qt_cever >= 600) - winver = QSysInfo::WV_CE_6; - if (qt_cever >= 500) - winver = QSysInfo::WV_CE_5; - else if (qt_cever >= 400) - winver = QSysInfo::WV_CENET; - else - winver = QSysInfo::WV_CE; - break; -#endif default: // VER_PLATFORM_WIN32_NT if (osver.dwMajorVersion < 5) { winver = QSysInfo::WV_NT; @@ -2168,15 +2140,6 @@ static const char *winVer_helper() return workstation ? "8.1" : "Server 2012 R2"; case QSysInfo::WV_WINDOWS10: return workstation ? "10" : "Server 2016"; - - case QSysInfo::WV_CE: - return "CE"; - case QSysInfo::WV_CENET: - return "CENET"; - case QSysInfo::WV_CE_5: - return "CE5"; - case QSysInfo::WV_CE_6: - return "CE6"; } // unknown, future version return 0; @@ -2434,7 +2397,7 @@ QString QSysInfo::buildCpuArchitecture() */ QString QSysInfo::currentCpuArchitecture() { -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +#if defined(Q_OS_WIN) // We don't need to catch all the CPU architectures in this function; // only those where the host CPU might be different than the build target // (usually, 64-bit platforms). @@ -2586,9 +2549,7 @@ static QString unknownText() */ QString QSysInfo::kernelType() { -#if defined(Q_OS_WINCE) - return QStringLiteral("wince"); -#elif defined(Q_OS_WIN) +#if defined(Q_OS_WIN) return QStringLiteral("winnt"); #elif defined(Q_OS_UNIX) struct utsname u; @@ -2652,8 +2613,7 @@ QString QSysInfo::kernelVersion() "unknown" otherwise. \b{Windows note}: this function returns "winphone" for builds for Windows - Phone, "winrt" for WinRT builds, "wince" for Windows CE and Embedded - Compact builds, and "windows" for normal desktop builds. + Phone, "winrt" for WinRT builds and "windows" for normal desktop builds. For other Unix-type systems, this function usually returns "unknown". @@ -2666,8 +2626,6 @@ QString QSysInfo::productType() return QStringLiteral("winphone"); #elif defined(Q_OS_WINRT) return QStringLiteral("winrt"); -#elif defined(Q_OS_WINCE) - return QStringLiteral("wince"); #elif defined(Q_OS_WIN) return QStringLiteral("windows"); diff --git a/src/corelib/global/qlogging.cpp b/src/corelib/global/qlogging.cpp index 86aa9b9e7a..0ded86de05 100644 --- a/src/corelib/global/qlogging.cpp +++ b/src/corelib/global/qlogging.cpp @@ -169,7 +169,7 @@ static bool isFatal(QtMsgType msgType) static bool willLogToConsole() { -#if defined(Q_OS_WINCE) || defined(Q_OS_WINRT) +#if defined(Q_OS_WINRT) // these systems have no stderr, so always log to the system log return false; #elif defined(QT_BOOTSTRAPPED) @@ -1165,7 +1165,7 @@ void QMessagePattern::setPattern(const QString &pattern) else if (inIf) error += QStringLiteral("QT_MESSAGE_PATTERN: missing %{endif}\n"); if (!error.isEmpty()) { -#if defined(Q_OS_WINCE) || defined(Q_OS_WINRT) +#if defined(Q_OS_WINRT) OutputDebugString(reinterpret_cast<const wchar_t*>(error.utf16())); if (0) #elif defined(Q_OS_WIN) && defined(QT_BUILD_CORE_LIB) diff --git a/src/corelib/global/qnumeric_p.h b/src/corelib/global/qnumeric_p.h index 5705bc29c8..b7f7d5187c 100644 --- a/src/corelib/global/qnumeric_p.h +++ b/src/corelib/global/qnumeric_p.h @@ -56,7 +56,7 @@ #include <cmath> #include <limits> -#if defined(Q_CC_MSVC) && !defined(Q_OS_WINCE) +#if defined(Q_CC_MSVC) # include <intrin.h> #elif defined(Q_CC_INTEL) # include <immintrin.h> // for _addcarry_u<nn> diff --git a/src/corelib/global/qsysinfo.h b/src/corelib/global/qsysinfo.h index 14f83e1df3..141d45e0db 100644 --- a/src/corelib/global/qsysinfo.h +++ b/src/corelib/global/qsysinfo.h @@ -109,13 +109,7 @@ public: WV_6_1 = WV_WINDOWS7, WV_6_2 = WV_WINDOWS8, WV_6_3 = WV_WINDOWS8_1, - WV_10_0 = WV_WINDOWS10, - - WV_CE = 0x0100, - WV_CENET = 0x0200, - WV_CE_5 = 0x0300, - WV_CE_6 = 0x0400, - WV_CE_based = 0x0f00 + WV_10_0 = WV_WINDOWS10 }; #if defined(Q_OS_WIN) || defined(Q_OS_CYGWIN) static const WinVersion WindowsVersion; diff --git a/src/corelib/global/qsystemdetection.h b/src/corelib/global/qsystemdetection.h index 97f750a3a6..ee4b88cdbb 100644 --- a/src/corelib/global/qsystemdetection.h +++ b/src/corelib/global/qsystemdetection.h @@ -56,7 +56,6 @@ OS2 - OS/2 OS2EMX - XFree86 on OS/2 (not PM) WIN32 - Win32 (Windows 2000/XP/Vista/7 and Windows Server 2003/2008) - WINCE - WinCE (Windows CE 5.0) WINRT - WinRT (Windows 8 Runtime) CYGWIN - Cygwin SOLARIS - Sun Solaris @@ -128,9 +127,7 @@ # define Q_OS_WIN32 # define Q_OS_WIN64 #elif !defined(SAG_COM) && (defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__)) -# if defined(WINCE) || defined(_WIN32_WCE) -# define Q_OS_WINCE -# elif defined(WINAPI_FAMILY) +# if defined(WINAPI_FAMILY) # ifndef WINAPI_FAMILY_PC_APP # define WINAPI_FAMILY_PC_APP WINAPI_FAMILY_APP # endif @@ -205,7 +202,7 @@ # error "Qt has not been ported to this OS - see http://www.qt-project.org/" #endif -#if defined(Q_OS_WIN32) || defined(Q_OS_WIN64) || defined(Q_OS_WINCE) || defined(Q_OS_WINRT) +#if defined(Q_OS_WIN32) || defined(Q_OS_WIN64) || defined(Q_OS_WINRT) # define Q_OS_WIN #endif 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 diff --git a/src/corelib/kernel/kernel.pri b/src/corelib/kernel/kernel.pri index adcc9c5581..06bfacce61 100644 --- a/src/corelib/kernel/kernel.pri +++ b/src/corelib/kernel/kernel.pri @@ -84,14 +84,6 @@ win32 { } } -wince { - SOURCES += \ - kernel/qfunctions_wince.cpp - HEADERS += \ - kernel/qfunctions_fake_env_p.h \ - kernel/qfunctions_wince.h -} - winrt { SOURCES += \ kernel/qfunctions_winrt.cpp diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp index 330a1eb0f5..6ee443b7f5 100644 --- a/src/corelib/kernel/qcoreapplication.cpp +++ b/src/corelib/kernel/qcoreapplication.cpp @@ -2259,14 +2259,6 @@ QStringList QCoreApplication::arguments() // classes by index. QString cmdline = QString::fromWCharArray(GetCommandLine()); -#if defined(Q_OS_WINCE) - wchar_t tempFilename[MAX_PATH+1]; - if (GetModuleFileName(0, tempFilename, MAX_PATH)) { - tempFilename[MAX_PATH] = 0; - cmdline.prepend(QLatin1Char('\"') + QString::fromWCharArray(tempFilename) + QLatin1String("\" ")); - } -#endif // Q_OS_WINCE - const QCoreApplicationPrivate *d = self->d_func(); if (d->origArgv) { const QStringList allArguments = qWinCmdArgs(cmdline); diff --git a/src/corelib/kernel/qcoreapplication_win.cpp b/src/corelib/kernel/qcoreapplication_win.cpp index 9cd8420a32..61576daba2 100644 --- a/src/corelib/kernel/qcoreapplication_win.cpp +++ b/src/corelib/kernel/qcoreapplication_win.cpp @@ -81,16 +81,12 @@ Q_CORE_EXPORT HINSTANCE qWinAppPrevInst() // get Windows prev app Q_CORE_EXPORT int qWinAppCmdShow() // get main window show command { -#if defined(Q_OS_WINCE) - return appCmdShow; -#else STARTUPINFO startupInfo; GetStartupInfo(&startupInfo); return (startupInfo.dwFlags & STARTF_USESHOWWINDOW) ? startupInfo.wShowWindow : SW_SHOWDEFAULT; -#endif } Q_CORE_EXPORT QString qAppFileName() // get application file name @@ -143,7 +139,7 @@ QString QCoreApplicationPrivate::appName() const qWinMain() - Initializes Windows. Called from WinMain() in qtmain_win.cpp *****************************************************************************/ -#if !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#if !defined(Q_OS_WINRT) // ### Qt6: FIXME: Consider removing this function. It is here for Active Qt // servers and for binary for compatibility to applications built with Qt 5.3 @@ -164,30 +160,7 @@ void qWinMain(HINSTANCE instance, HINSTANCE prevInstance, LPSTR cmdParam, argv.append(_strdup(wArg.toLocal8Bit().constData())); } -#elif defined(Q_OS_WINCE) - -Q_CORE_EXPORT void __cdecl qWinMain(HINSTANCE instance, HINSTANCE prevInstance, LPSTR cmdParam, - int cmdShow, int &argc, QVector<char *> &argv) -{ - static bool already_called = false; - - if (already_called) { - qWarning("Qt: Internal error: qWinMain should be called only once"); - return; - } - already_called = true; - - // Create command line - argv = qWinCmdLine<char>(cmdParam, int(strlen(cmdParam)), argc); - - appCmdShow = cmdShow; - - // Ignore Windows parameters - Q_UNUSED(instance); - Q_UNUSED(prevInstance); -} - -#endif // Q_OS_WINCE +#endif // !Q_OS_WINRT #ifndef QT_NO_QOBJECT diff --git a/src/corelib/kernel/qcorecmdlineargs_p.h b/src/corelib/kernel/qcorecmdlineargs_p.h index 2d8de08f2d..c5d9d130f0 100644 --- a/src/corelib/kernel/qcorecmdlineargs_p.h +++ b/src/corelib/kernel/qcorecmdlineargs_p.h @@ -81,93 +81,7 @@ static inline QStringList qWinCmdArgs(const QString &cmdLine) return result; } -#elif defined(Q_OS_WINCE) // Q_OS_WIN32 - -// template implementation of the parsing algorithm -// this is used from qcoreapplication_win.cpp and the tools (rcc, uic...) - -template<typename Char> -static QVector<Char*> qWinCmdLine(Char *cmdParam, int length, int &argc) -{ - QVector<Char*> argv(8); - Char *p = cmdParam; - Char *p_end = p + length; - - argc = 0; - - while (*p && p < p_end) { // parse cmd line arguments - while (QChar((short)(*p)).isSpace()) // skip white space - p++; - if (*p && p < p_end) { // arg starts - int quote; - Char *start, *r; - if (*p == Char('\"')) { - quote = *p; - start = ++p; - } else { - quote = 0; - start = p; - } - r = start; - while (*p && p < p_end) { - if (quote) { - if (*p == quote) { - p++; - if (QChar((short)(*p)).isSpace()) - break; - quote = 0; - } - } - if (*p == '\\') { // escape char? - // testing by looking at argc, argv shows that it only escapes quotes - if (p < p_end && (*(p+1) == Char('\"'))) - p++; - } else { - if (!quote && (*p == Char('\"'))) { - quote = *p++; - continue; - } else if (QChar((short)(*p)).isSpace() && !quote) - break; - } - if (*p) - *r++ = *p++; - } - if (*p && p < p_end) - p++; - *r = Char('\0'); - - if (argc >= (int)argv.size()-1) // expand array - argv.resize(argv.size()*2); - argv[argc++] = start; - } - } - argv[argc] = 0; - - return argv; -} - -static inline QStringList qWinCmdArgs(QString cmdLine) // not const-ref: this might be modified -{ - QStringList args; - - int argc = 0; - QVector<wchar_t*> argv = qWinCmdLine<wchar_t>((wchar_t *)cmdLine.utf16(), cmdLine.length(), argc); - for (int a = 0; a < argc; ++a) { - args << QString::fromWCharArray(argv[a]); - } - - return args; -} - -static inline QStringList qCmdLineArgs(int argc, char *argv[]) -{ - Q_UNUSED(argc) - Q_UNUSED(argv) - QString cmdLine = QString::fromWCharArray(GetCommandLine()); - return qWinCmdArgs(cmdLine); -} - -#elif defined(Q_OS_WINRT) // Q_OS_WINCE +#elif defined(Q_OS_WINRT) // Q_OS_WIN32 static inline QStringList qCmdLineArgs(int argc, char *argv[]) { diff --git a/src/corelib/kernel/qeventdispatcher_win.cpp b/src/corelib/kernel/qeventdispatcher_win.cpp index 4d7aa83c43..4007824c99 100644 --- a/src/corelib/kernel/qeventdispatcher_win.cpp +++ b/src/corelib/kernel/qeventdispatcher_win.cpp @@ -63,11 +63,7 @@ extern uint qGlobalPostedEventsCount(); #endif #ifndef QS_RAWINPUT -# ifdef Q_OS_WINCE -# define QS_RAWINPUT 0x0000 -# else # define QS_RAWINPUT 0x0400 -# endif #endif #ifndef WM_TOUCH @@ -89,196 +85,6 @@ enum { SendPostedEventsWindowsTimerId = ~1u }; -#if defined(Q_OS_WINCE) -QT_BEGIN_INCLUDE_NAMESPACE -#include <winsock.h> -QT_END_INCLUDE_NAMESPACE -// Asynchronous Winsocks ------------------------------------------ -#ifndef QT_NO_THREAD -QT_BEGIN_INCLUDE_NAMESPACE -#include <qthread.h> -#include <qmap.h> -#include <qmutex.h> -QT_END_INCLUDE_NAMESPACE - -//#define QCE_ASYNC_DEBUG - -namespace { - class SocketAsyncHandler; - - class SocketAsyncHandler : public QThread - { - public: - SocketAsyncHandler(); - ~SocketAsyncHandler(); - void run(); - void select(SOCKET sock, HWND handle, unsigned int msg, long ev); - void removeSelect(SOCKET sock); - void safeRemove(SOCKET sock); - private: - struct SockInfo { - HWND handle; - unsigned int msg; - long ev; - }; - QMap<SOCKET, SockInfo> sockets; - QMutex mutex; - QWaitCondition cond; - bool supposedToDie; - }; - - SocketAsyncHandler::SocketAsyncHandler() - : supposedToDie(false) - { - } - - SocketAsyncHandler::~SocketAsyncHandler() - { - mutex.lock(); - supposedToDie = true; - mutex.unlock(); - cond.wakeOne(); - wait(); - while (sockets.size() > 0) - removeSelect(sockets.begin().key()); - } - - void SocketAsyncHandler::removeSelect(SOCKET sock) - { - if (!sockets.contains(sock)) - return; - sockets.remove(sock); - return; - } - - void SocketAsyncHandler::safeRemove(SOCKET sock) - { - QMutexLocker locker(&mutex); - removeSelect(sock); - } - - void SocketAsyncHandler::select(SOCKET sock, HWND handle, unsigned int msg, long ev) - { - QMutexLocker locker(&mutex); - - if (sockets.contains(sock)) - sockets.remove(sock); - - SockInfo info; - info.handle = handle; - info.msg = msg; - info.ev = ev; - sockets.insert(sock, info); - cond.wakeOne(); - } - - void SocketAsyncHandler::run() - { - do { - mutex.lock(); - - while (!supposedToDie && sockets.isEmpty()) { - cond.wait(&mutex); - } - - if (supposedToDie) { - mutex.unlock(); - break; - } - - // Copy current items to reduce lock time - // and to be able to use SendMessage - QMap<SOCKET, SockInfo> currentSockets = sockets; - mutex.unlock(); - - fd_set readS, writeS, exS; - FD_ZERO(&readS); - FD_ZERO(&writeS); - FD_ZERO(&exS); - - int maxFd = 0; - - for (QMap<SOCKET, SockInfo>::iterator it = currentSockets.begin(); it != currentSockets.end(); ++it) { - const SockInfo &info = it.value(); - int socket = it.key(); - maxFd = qMax(maxFd, socket); - - if ((info.ev & FD_READ) || (info.ev & FD_CLOSE) || (info.ev & FD_ACCEPT)) - FD_SET(socket, &readS); - if ((info.ev & FD_WRITE)|| (info.ev & FD_CONNECT)) - FD_SET(socket, &writeS); - if (info.ev & FD_OOB) - FD_SET(socket, &exS); - } - - timeval timeout; - timeout.tv_sec = 0; - timeout.tv_usec = 50000; - int result = ::select(maxFd + 1, &readS, &writeS, &exS, &timeout); - if (result > 0) { - HWND handle; - unsigned int tmpMsg; - SOCKET sock; - HRESULT ret; - for (QMap<SOCKET, SockInfo>::const_iterator it = currentSockets.constBegin(); - it != currentSockets.constEnd(); ++it) { - handle = (*it).handle; - tmpMsg = (*it).msg; - sock = it.key(); - if (FD_ISSET(sock, &readS)) - ret = SendMessage(handle, tmpMsg, sock, FD_READ); - - if (FD_ISSET(sock, &writeS)) - ret = SendMessage(handle, tmpMsg, sock, FD_WRITE); - - if (FD_ISSET(sock, &exS)) - ret = SendMessage(handle, tmpMsg, sock, FD_OOB); - } - } - -#ifdef QCE_ASYNC_DEBUG - else if (result == 0) { //timeout - qDebug(" WSAAsync select timeout"); - } else if (result < 0) { // SocketError - // This might happen because of two reasons - // 1. We already closed a socket in between the copy and the select - // and thus select() returns an error - // 2. Something is really wrong, then - // ### Loop on all descriptors, try to select and remove the - // ### broken one. - qWarning("WSAAsync select error %d", WSAGetLastError()); - } -#endif - } while(true); - } -} // namespace - -Q_GLOBAL_STATIC(SocketAsyncHandler, qt_async_handler) - -int WSAAsyncSelect(SOCKET sock, HWND handle, unsigned int msg, long ev) -{ - if (sock == 0 || handle == 0 || handle == INVALID_HANDLE_VALUE) { - WSASetLastError(WSAEINVAL); - return SOCKET_ERROR; - } - - if (msg == 0 && ev == 0) - qt_async_handler()->safeRemove(sock); - else - qt_async_handler()->select(sock, handle, msg, ev); - - qt_async_handler()->start(QThread::LowPriority); - WSASetLastError(0); - return 0; -} -#else // QT_NO_THREAD -int WSAAsyncSelect(SOCKET, HWND, unsigned int, long) -{ - return SOCKET_ERROR; -} -#endif -#endif // Q_OS_WINCE - class QEventDispatcherWin32Private; #if !defined(DWORD_PTR) && !defined(Q_OS_WIN64) @@ -303,13 +109,8 @@ static void resolveTimerAPI() return; #endif triedResolve = true; -#if !defined(Q_OS_WINCE) qtimeSetEvent = (ptimeSetEvent)QSystemLibrary::resolve(QLatin1String("winmm"), "timeSetEvent"); qtimeKillEvent = (ptimeKillEvent)QSystemLibrary::resolve(QLatin1String("winmm"), "timeKillEvent"); -#else - qtimeSetEvent = (ptimeSetEvent)QSystemLibrary::resolve(QLatin1String("Mmtimer"), "timeSetEvent"); - qtimeKillEvent = (ptimeKillEvent)QSystemLibrary::resolve(QLatin1String("Mmtimer"), "timeKillEvent"); -#endif } } @@ -495,11 +296,7 @@ LRESULT QT_WIN_CALLBACK qt_GetMessageHook(int code, WPARAM wp, LPARAM lp) } } } -#ifdef Q_OS_WINCE - return 0; -#else return q->d_func()->getMessageHook ? CallNextHookEx(0, code, wp, lp) : 0; -#endif } // Provide class name and atom for the message window used by @@ -557,16 +354,11 @@ static HWND qt_create_internal_window(const QEventDispatcherWin32 *eventDispatch QWindowsMessageWindowClassContext *ctx = qWindowsMessageWindowClassContext(); if (!ctx->atom) return 0; -#ifdef Q_OS_WINCE - HWND parent = 0; -#else - HWND parent = HWND_MESSAGE; -#endif HWND wnd = CreateWindow(ctx->className, // classname ctx->className, // window name 0, // style 0, 0, 0, 0, // geometry - parent, // parent + HWND_MESSAGE, // parent 0, // menu handle qWinAppInst(), // application 0); // windows creation data. @@ -693,7 +485,6 @@ void QEventDispatcherWin32::installMessageHook() if (d->getMessageHook) return; -#ifndef Q_OS_WINCE // setup GetMessage hook needed to drive our posted events d->getMessageHook = SetWindowsHookEx(WH_GETMESSAGE, (HOOKPROC) qt_GetMessageHook, NULL, GetCurrentThreadId()); if (Q_UNLIKELY(!d->getMessageHook)) { @@ -701,17 +492,14 @@ void QEventDispatcherWin32::installMessageHook() qFatal("Qt: INTERNAL ERROR: failed to install GetMessage hook: %d, %s", errorCode, qPrintable(qt_error_string(errorCode))); } -#endif } void QEventDispatcherWin32::uninstallMessageHook() { Q_D(QEventDispatcherWin32); -#ifndef Q_OS_WINCE if (d->getMessageHook) UnhookWindowsHookEx(d->getMessageHook); -#endif d->getMessageHook = 0; } @@ -1143,11 +931,7 @@ void QEventDispatcherWin32::activateEventNotifiers() Q_D(QEventDispatcherWin32); //### this could break if events are removed/added in the activation for (int i=0; i<d->winEventNotifierList.count(); i++) { -#if !defined(Q_OS_WINCE) if (WaitForSingleObjectEx(d->winEventNotifierList.at(i)->handle(), 0, TRUE) == WAIT_OBJECT_0) -#else - if (WaitForSingleObject(d->winEventNotifierList.at(i)->handle(), 0) == WAIT_OBJECT_0) -#endif d->activateEventNotifier(d->winEventNotifierList.at(i)); } } diff --git a/src/corelib/kernel/qfunctions_p.h b/src/corelib/kernel/qfunctions_p.h index 06f5ea09da..ff035fcb11 100644 --- a/src/corelib/kernel/qfunctions_p.h +++ b/src/corelib/kernel/qfunctions_p.h @@ -53,9 +53,7 @@ #include <QtCore/qglobal.h> -#if defined(Q_OS_WINCE) -# include "QtCore/qfunctions_wince.h" -#elif defined(Q_OS_VXWORKS) +#if defined(Q_OS_VXWORKS) # include "QtCore/qfunctions_vxworks.h" #elif defined(Q_OS_NACL) # include "QtCore/qfunctions_nacl.h" diff --git a/src/corelib/kernel/qfunctions_wince.cpp b/src/corelib/kernel/qfunctions_wince.cpp deleted file mode 100644 index 104c6fb27c..0000000000 --- a/src/corelib/kernel/qfunctions_wince.cpp +++ /dev/null @@ -1,407 +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$ -** -****************************************************************************/ -#ifdef _WIN32_WCE //Q_OS_WINCE - -#include <windows.h> -#include <winbase.h> -#include <kfuncs.h> -#include <stdio.h> -#if _WIN32_WCE < 0x800 -# include <altcecrt.h> -#else -# include <fcntl.h> -#endif - -#include "qplatformdefs.h" -#include "qfunctions_wince.h" -#include "qfunctions_fake_env_p.h" -#include "qstring.h" - -QT_USE_NAMESPACE - -#ifdef __cplusplus -extern "C" { -#endif - -wchar_t* CEPrivConvCharToWide(const char* string) -{ - size_t length = strlen(string); - wchar_t* wString = new wchar_t[length +1]; - for (unsigned int i = 0; i < (length +1); i++) - wString[i] = string[i]; - return wString; -} - -// Time ------------------------------------------------------------- -time_t qt_wince_ftToTime_t( const FILETIME ft ) -{ - ULARGE_INTEGER li; - li.LowPart = ft.dwLowDateTime; - li.HighPart = ft.dwHighDateTime; - - // 100-nanosec to seconds - li.QuadPart /= 10000000; - - // FILETIME is from 1601-01-01 T 00:00:00 - // time_t is from 1970-01-01 T 00:00:00 - // 1970 - 1601 = 369 year (89 leap years) - // - // ((369y*365d) + 89d) *24h *60min *60sec - // = 11644473600 seconds - li.QuadPart -= 11644473600; - return li.LowPart; -} - -FILETIME qt_wince_time_tToFt( time_t tt ) -{ - ULARGE_INTEGER li; - li.QuadPart = tt; - li.QuadPart += 11644473600; - li.QuadPart *= 10000000; - - FILETIME ft; - ft.dwLowDateTime = li.LowPart; - ft.dwHighDateTime = li.HighPart; - return ft; -} - -// File I/O --------------------------------------------------------- -#if _WIN32_WCE < 0x800 -int errno = 0; -#endif - -int qt_wince__getdrive( void ) -{ - return 1; -} - -int qt_wince__waccess( const wchar_t *path, int pmode ) -{ - DWORD res = GetFileAttributes( path ); - if ( 0xFFFFFFFF == res ) - return -1; - - if ( (pmode & W_OK) && (res & FILE_ATTRIBUTE_READONLY) ) - return -1; - - if ( (pmode & X_OK) && !(res & FILE_ATTRIBUTE_DIRECTORY) ) { - QString file = QString::fromWCharArray(path); - if ( !(file.endsWith(QString::fromLatin1(".exe")) || - file.endsWith(QString::fromLatin1(".com"))) ) - return -1; - } - - return 0; -} - -int qt_wince_open( const char *filename, int oflag, int pmode ) -{ - QString fn( QString::fromLatin1(filename) ); - return _wopen( (wchar_t*)fn.utf16(), oflag, pmode ); -} - -int qt_wince__wopen( const wchar_t *filename, int oflag, int /*pmode*/ ) -{ - wchar_t *flag; - - if ( oflag & _O_APPEND ) { - if ( oflag & _O_WRONLY ) { - flag = L"a"; - } else if ( oflag & _O_RDWR ) { - flag = L"a+"; - } - } else if (oflag & _O_BINARY) { - if ( oflag & _O_WRONLY ) { - flag = L"wb"; - } else if ( oflag & _O_RDWR ) { - flag = L"w+b"; // slightly different from "r+" where the file must exist - } else if ( oflag & _O_RDONLY ) { - flag = L"rb"; - } else { - flag = L"b"; - } - } else { - if ( oflag & _O_WRONLY ) { - flag = L"wt"; - } else if ( oflag & _O_RDWR ) { - flag = L"w+t"; // slightly different from "r+" where the file must exist - } else if ( oflag & _O_RDONLY ) { - flag = L"rt"; - } else { - flag = L"t"; - } - } - - int retval = (int)_wfopen( filename, flag ); - return (retval == NULL) ? -1 : retval; -} - -long qt_wince__lseek( int handle, long offset, int origin ) -{ - return fseek( (FILE*)handle, offset, origin ); -} - -int qt_wince__read( int handle, void *buffer, unsigned int count ) -{ - return fread( buffer, 1, count, (FILE*)handle ); -} - -int qt_wince__write( int handle, const void *buffer, unsigned int count ) -{ - return fwrite( buffer, 1, count, (FILE*)handle ); -} - -int qt_wince__close( int handle ) -{ - if (!handle) - return 0; - return fclose( (FILE*)handle ); -} - -FILE *qt_wince__fdopen(int handle, const char* /*mode*/) -{ - return (FILE*)handle; -} - -FILE *qt_wince_fdopen( int handle, const char* /*mode*/ ) -{ - return (FILE*)handle; -} - -void qt_wince_rewind( FILE *stream ) -{ - fseek( stream, 0L, SEEK_SET ); -} - -int qt_wince___fileno(FILE *f) -{ - return (int) _fileno(f); -} - -FILE *qt_wince_tmpfile( void ) -{ - static long i = 0; - char name[16]; - sprintf( name, "tmp%i", i++ ); - return fopen( name, "r+" ); -} - -int qt_wince__mkdir(const char *dirname) -{ - return CreateDirectory(reinterpret_cast<const wchar_t *> (QString(QString::fromLatin1(dirname)).utf16()), 0) ? 0 : -1; -} - -int qt_wince__rmdir(const char *dirname) -{ - return RemoveDirectory(reinterpret_cast<const wchar_t *> (QString::fromLatin1(dirname).utf16())) ? 0 : -1; -} - -int qt_wince__access( const char *path, int pmode ) -{ - return _waccess(reinterpret_cast<const wchar_t *> (QString::fromLatin1(path).utf16()),pmode); -} - -int qt_wince__rename( const char *oldname, const char *newname ) -{ - return !MoveFile(reinterpret_cast<const wchar_t *> (QString::fromLatin1(oldname).utf16()), reinterpret_cast<const wchar_t *> (QString::fromLatin1(newname).utf16())); -} - -int qt_wince__remove( const char *name ) -{ - return !DeleteFile(reinterpret_cast<const wchar_t *> (QString::fromLatin1(name).utf16())); -} - -int qt_wince_stat( const char *path, struct stat *buffer ) -{ - WIN32_FIND_DATA finfo; - HANDLE ff = FindFirstFile( reinterpret_cast<const wchar_t *> (QString::fromLatin1(path).utf16()), &finfo ); - - if ( ff == INVALID_HANDLE_VALUE ) - return -1; - - buffer->st_ctime = qt_wince_ftToTime_t( finfo.ftCreationTime ); - buffer->st_atime = qt_wince_ftToTime_t( finfo.ftLastAccessTime ); - buffer->st_mtime = qt_wince_ftToTime_t( finfo.ftLastWriteTime ); - buffer->st_nlink = 0; - buffer->st_size = finfo.nFileSizeLow; // ### missing high! - buffer->st_mode = (finfo.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) ? _S_IFDIR : _S_IFREG; - buffer->st_mode |= (finfo.dwFileAttributes & FILE_ATTRIBUTE_READONLY) ? _O_RDONLY : _O_RDWR; - return (FindClose(ff) == 0); -} - -int qt_wince__fstat( int handle, struct stat *buffer) -{ - BY_HANDLE_FILE_INFORMATION fInfo; - BOOL res = GetFileInformationByHandle((HANDLE)handle, &fInfo); - - buffer->st_ctime = qt_wince_ftToTime_t( fInfo.ftCreationTime ); - buffer->st_atime = qt_wince_ftToTime_t( fInfo.ftLastAccessTime ); - buffer->st_mtime = qt_wince_ftToTime_t( fInfo.ftLastWriteTime ); - buffer->st_nlink = 0; - buffer->st_size = fInfo.nFileSizeLow; // ### missing high! - buffer->st_mode = (fInfo.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) ? _S_IFDIR : _S_IFREG; - buffer->st_mode |= (fInfo.dwFileAttributes & FILE_ATTRIBUTE_READONLY) ? _O_RDONLY : _O_RDWR; - return (res == 0); -} - -int qt_wince_SetErrorMode(int newValue) -{ - static int oldValue; - int result = oldValue; - oldValue = newValue; - return result; -} - -bool qt_wince__chmod(const char *file, int mode) -{ - return _wchmod( reinterpret_cast<const wchar_t *> (QString::fromLatin1(file).utf16()), mode); -} - -bool qt_wince__wchmod(const wchar_t *file, int mode) -{ - BOOL success = FALSE; - // ### Does not work properly, what about just adding one property? - if(mode&_S_IWRITE) { - success = SetFileAttributes(file, FILE_ATTRIBUTE_NORMAL); - } else if((mode&_S_IREAD) && !(mode&_S_IWRITE)) { - success = SetFileAttributes(file, FILE_ATTRIBUTE_READONLY); - } - return success ? 0 : -1; -} - -HANDLE qt_wince_CreateFileA(LPCSTR filename, DWORD access, DWORD share, LPSECURITY_ATTRIBUTES attr, DWORD dispo, DWORD flags, HANDLE tempFile) -{ - return CreateFileW( reinterpret_cast<const wchar_t *>(QString::fromLatin1(filename).utf16()), access, share, attr, dispo, flags, tempFile); -} - -// Graphics --------------------------------------------------------- -BOOL qt_wince_SetWindowOrgEx( HDC /*hdc*/, int /*X*/, int /*Y*/, LPPOINT /*lpPoint*/) { - return TRUE; -} - -// Threading -------------------------------------------------------- -HANDLE qt_wince__beginthread(void( *start_address )( void * ), unsigned stack_size, void *arglist) -{ - unsigned initflag = 0; - if (stack_size > 0) - initflag |= STACK_SIZE_PARAM_IS_A_RESERVATION; - return CreateThread(NULL, stack_size, (LPTHREAD_START_ROUTINE)start_address, arglist, initflag, NULL); -} - -unsigned long qt_wince__beginthreadex( void *security, - unsigned stack_size, - unsigned (__stdcall *start_address)(void *), - void *arglist, - unsigned initflag, - unsigned *thrdaddr) -{ - if (stack_size > 0) - initflag |= STACK_SIZE_PARAM_IS_A_RESERVATION; - return (unsigned long) - CreateThread( (LPSECURITY_ATTRIBUTES)security, - (DWORD)stack_size, - (LPTHREAD_START_ROUTINE)start_address, - (LPVOID)arglist, - (DWORD)initflag | CREATE_SUSPENDED, - (LPDWORD)thrdaddr); -} - -void qt_wince__endthreadex(unsigned nExitCode) { - ExitThread((DWORD)nExitCode); -} - -void *qt_wince_bsearch(const void *key, - const void *base, - size_t num, - size_t size, - int (__cdecl *compare)(const void *, const void *)) -{ - size_t low = 0; - size_t high = num - 1; - while (low <= high) { - size_t mid = (low + high) >> 1; - int c = compare(key, (char*)base + mid * size); - if (c < 0) { - if (!mid) - break; - high = mid - 1; - } else if (c > 0) - low = mid + 1; - else - return (char*) base + mid * size; - } - return 0; -} - -void *lfind(const void* key, const void* base, size_t* elements, size_t size, - int (__cdecl *compare)(const void*, const void*)) -{ - const char* current = (char*) base; - const char* const end = (char*) (current + (*elements) * size); - while (current != end) { - if (compare(current, key) == 0) - return (void*)current; - current += size; - } - return 0; -} - -DWORD qt_wince_GetThreadLocale(void) -{ - return GetUserDefaultLCID(); -} - -void *qt_wince_calloc( size_t num, size_t size ) -{ - void *ptr = malloc( num * size ); - if( ptr ) - memset( ptr, 0, num * size ); - return ptr; -} - -// _getpid is currently only used for creating a temporary filename -int qt_wince__getpid() -{ - return qAbs((int)GetCurrentProcessId()); -} - -#ifdef __cplusplus -} // extern "C" -#endif -#endif // Q_OS_WINCE diff --git a/src/corelib/kernel/qfunctions_wince.h b/src/corelib/kernel/qfunctions_wince.h deleted file mode 100644 index 030950e1bd..0000000000 --- a/src/corelib/kernel/qfunctions_wince.h +++ /dev/null @@ -1,473 +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$ -** -****************************************************************************/ - -#ifndef QFUNCTIONS_WINCE_H -#define QFUNCTIONS_WINCE_H - -#include <QtCore/qglobal.h> - -#ifdef Q_OS_WINCE -# ifndef NOMINMAX -# define NOMINMAX -# endif -#include <stdio.h> -#include <stdlib.h> -#include <windows.h> -#include <winuser.h> -#include <winbase.h> -#include <objbase.h> -#include <kfuncs.h> -#include <ctype.h> -#include <time.h> -#include <crtdefs.h> -#if _WIN32_WCE < 0x800 -# include <altcecrt.h> -#else -# include <fcntl.h> -# include <stat.h> -#endif -#include <winsock.h> -#include <ceconfig.h> - -QT_BEGIN_NAMESPACE - -#ifdef QT_BUILD_CORE_LIB -#endif - -QT_END_NAMESPACE - -// The standard SDK misses this define... -#define _control87 _controlfp - -#if !defined __cplusplus -#define bool int -#define true 1 -#define false 0 -#endif - -// Environment ------------------------------------------------------ -errno_t qt_fake_getenv_s(size_t*, char*, size_t, const char*); -errno_t qt_fake__putenv_s(const char*, const char*); - -#ifdef __cplusplus // have this as tiff plugin is written in C -extern "C" { -#endif - -#if !defined(NO_ERRNO_H) -#define NO_ERRNO_H -#endif - -// Environment ------------------------------------------------------ -int qt_wince__getpid(void); - - -// Time ------------------------------------------------------------- -#ifndef _TM_DEFINED -#define _TM_DEFINED -struct tm { - int tm_sec; /* seconds after the minute - [0,59] */ - int tm_min; /* minutes after the hour - [0,59] */ - int tm_hour; /* hours since midnight - [0,23] */ - int tm_mday; /* day of the month - [1,31] */ - int tm_mon; /* months since January - [0,11] */ - int tm_year; /* years since 1900 */ - int tm_wday; /* days since Sunday - [0,6] */ - int tm_yday; /* days since January 1 - [0,365] */ - int tm_isdst; /* daylight-saving time flag */ -}; -#endif // _TM_DEFINED - -FILETIME qt_wince_time_tToFt( time_t tt ); -time_t qt_wince_ftToTime_t( const FILETIME ft ); - -#if _WIN32_WCE < 0x800 - -// File I/O --------------------------------------------------------- -#define _O_RDONLY 0x0001 -#define _O_RDWR 0x0002 -#define _O_WRONLY 0x0004 -#define _O_CREAT 0x0008 -#define _O_TRUNC 0x0010 -#define _O_APPEND 0x0020 -#define _O_EXCL 0x0040 - -#define O_RDONLY _O_RDONLY -#define O_RDWR _O_RDWR -#define O_WRONLY _O_WRONLY -#define O_CREAT _O_CREAT -#define O_TRUNC _O_TRUNC -#define O_APPEND _O_APPEND -#define O_EXCL _O_EXCL - -#define _S_IFMT 0x0600 -#define _S_IFDIR 0x0200 -#define _S_IFCHR 0x0100 -#define _S_IFREG 0x0400 -#define _S_IREAD 0x0010 -#define _S_IWRITE 0x0008 - -#define S_IFMT _S_IFMT -#define S_IFDIR _S_IFDIR -#define S_IFCHR _S_IFCHR -#define S_IFREG _S_IFREG -#define S_IREAD _S_IREAD -#define S_IWRITE _S_IWRITE - -#ifndef _IOFBF -#define _IOFBF 0x0000 -#endif - -#ifndef _IOLBF -#define _IOLBF 0x0040 -#endif - -#ifndef _IONBF -#define _IONBF 0x0004 -#endif - -// Regular Berkeley error constants -#ifndef _STAT_DEFINED -#define _STAT_DEFINED -struct stat -{ - int st_mode; - int st_size; - int st_nlink; - time_t st_mtime; - time_t st_atime; - time_t st_ctime; -}; -#endif - -typedef int mode_t; -extern int errno; -#endif // _WIN32_WCE < 0x800 - -int qt_wince__getdrive( void ); -int qt_wince__waccess( const wchar_t *path, int pmode ); -int qt_wince__wopen( const wchar_t *filename, int oflag, int pmode ); -long qt_wince__lseek( int handle, long offset, int origin ); -int qt_wince__read( int handle, void *buffer, unsigned int count ); -int qt_wince__write( int handle, const void *buffer, unsigned int count ); -int qt_wince__close( int handle ); -FILE *qt_wince__fdopen(int handle, const char *mode); -FILE *qt_wince_fdopen(int handle, const char *mode); -void qt_wince_rewind( FILE *stream ); -int qt_wince___fileno(FILE *); -FILE *qt_wince_tmpfile( void ); - -//For zlib we need these helper functions, but they break the build when -//set globally, so just set them for zlib use -#ifdef ZLIB_H -#define open qt_wince_open -#define close qt_wince__close -#define lseek qt_wince__lseek -#define read qt_wince__read -#define write qt_wince__write -#endif - -int qt_wince__mkdir(const char *dirname); -int qt_wince__rmdir(const char *dirname); -int qt_wince__access( const char *path, int pmode ); -int qt_wince__rename( const char *oldname, const char *newname ); -int qt_wince__remove( const char *name ); -#ifdef __cplusplus -int qt_wince_open( const char *filename, int oflag, int pmode = 0 ); -#else -int qt_wince_open( const char *filename, int oflag, int pmode ); -#endif -int qt_wince_stat( const char *path, struct stat *buffer ); -int qt_wince__fstat( int handle, struct stat *buffer); - -#define SEM_FAILCRITICALERRORS 0x0001 -#define SEM_NOOPENFILEERRORBOX 0x0002 -int qt_wince_SetErrorMode(int); -#ifndef CoInitialize -#define CoInitialize(x) CoInitializeEx(x, COINIT_MULTITHREADED) -#endif - -bool qt_wince__chmod(const char *file, int mode); -bool qt_wince__wchmod(const wchar_t *file, int mode); - -QT_WARNING_DISABLE_MSVC(4273) -HANDLE qt_wince_CreateFileA(LPCSTR, DWORD, DWORD, LPSECURITY_ATTRIBUTES, DWORD, DWORD, HANDLE); - -// Printer ---------------------------------------------------------- -#define ETO_GLYPH_INDEX 0x0010 - -// Graphics --------------------------------------------------------- -#ifndef SM_CXCURSOR -# define SM_CXCURSOR 13 -#endif -#ifndef SM_CYCURSOR -# define SM_CYCURSOR 14 -#endif -BOOL qt_wince_SetWindowOrgEx( HDC hdc, int X, int Y, LPPOINT lpPoint ); - -// Other stuff ------------------------------------------------------ -#define MWMO_ALERTABLE 0x0002 -// ### not the real values -#define CREATE_NO_WINDOW 2 -#define CF_HDROP 15 - -void *qt_wince_calloc(size_t num, size_t size); -#if !defined(TLS_OUT_OF_INDEXES) -# define TLS_OUT_OF_INDEXES 0xffffffff -#endif -DWORD qt_wince_GetThreadLocale(void); - -HANDLE qt_wince__beginthread(void( *start_address )( void * ), unsigned stack_size, void *arglist); - -unsigned long qt_wince__beginthreadex( void *security, - unsigned stack_size, - unsigned (__stdcall *start_address)(void *), - void *arglist, - unsigned initflag, - unsigned *thrdaddr ); -void qt_wince__endthreadex(unsigned nExitCode); - - -// bsearch is needed for building the tiff plugin -// otherwise it could go into qguifunctions_wce -void *qt_wince_bsearch(const void *key, - const void *base, - size_t num, - size_t size, - int (__cdecl *compare)(const void *, const void *)); - -// Missing typedefs -#ifndef _TIME_T_DEFINED -typedef unsigned long time_t; -#define _TIME_T_DEFINED -#endif -typedef HANDLE HDROP; - -#ifndef WS_THICKFRAME -#define WS_THICKFRAME WS_DLGFRAME -#endif - -typedef UINT UWORD; - -// Missing definitions: not necessary equal to their Win32 values -// (the goal is to just have a clean compilation of MFC) -#define WS_MAXIMIZE 0 -#define WS_MINIMIZE 0 -#ifndef WS_EX_TOOLWINDOW -#define WS_EX_TOOLWINDOW 0 -#endif -#define WS_EX_NOPARENTNOTIFY 0 -#define WM_ENTERIDLE 0x0121 -#define WM_PRINT WM_PAINT -#define WM_NCCREATE (0x0081) -#define WM_PARENTNOTIFY 0 -#define WM_NCDESTROY (WM_APP-1) -#ifndef SW_RESTORE -#define SW_RESTORE (SW_SHOWNORMAL) -#endif -#define SW_NORMAL (SW_SHOWNORMAL) -#define WAIT_OBJECT_0 0x00000000L -#define DEFAULT_GUI_FONT SYSTEM_FONT -#ifndef SWP_NOREDRAW -#define SWP_NOREDRAW 0 -#endif -#define WSAGETSELECTEVENT(lParam) LOWORD(lParam) -#define HWND_TOPMOST ((HWND)-1) -#define HWND_NOTOPMOST ((HWND)-2) -#define PS_DOT 2 -#define PD_ALLPAGES 0 -#define PD_USEDEVMODECOPIES 0 -#define PD_NOSELECTION 0 -#define PD_HIDEPRINTTOFILE 0 -#define PD_NOPAGENUMS 0 -#define CF_METAFILEPICT 3 -#define MM_ANISOTROPIC 8 -#define KF_ALTDOWN 0x2000 -#define SPI_GETWORKAREA 48 - -#ifndef WM_SETCURSOR - #define WM_SETCURSOR 0x0020 - #define IDC_ARROW MAKEINTRESOURCE(32512) - #define IDC_IBEAM MAKEINTRESOURCE(32513) - #define IDC_WAIT MAKEINTRESOURCE(32514) - #define IDC_CROSS MAKEINTRESOURCE(32515) - #define IDC_UPARROW MAKEINTRESOURCE(32516) - #define IDC_SIZE MAKEINTRESOURCE(32646) - #define IDC_ICON MAKEINTRESOURCE(32512) - #define IDC_SIZENWSE MAKEINTRESOURCE(32642) - #define IDC_SIZENESW MAKEINTRESOURCE(32643) - #define IDC_SIZEWE MAKEINTRESOURCE(32644) - #define IDC_SIZENS MAKEINTRESOURCE(32645) - #define IDC_SIZEALL MAKEINTRESOURCE(32646) - #define IDC_NO MAKEINTRESOURCE(32648) - #define IDC_APPSTARTING MAKEINTRESOURCE(32650) - #define IDC_HELP MAKEINTRESOURCE(32651) - #define IDC_HAND MAKEINTRESOURCE(32649) -#endif - -#define GMEM_MOVEABLE LMEM_MOVEABLE -#define GPTR LPTR - -// WinCE: CESYSGEN prunes the following FRP defines, -// and INTERNET_TRANSFER_TYPE_ASCII breaks in wininet.h -#undef FTP_TRANSFER_TYPE_ASCII -#define FTP_TRANSFER_TYPE_ASCII 0x00000001 -#undef FTP_TRANSFER_TYPE_BINARY -#define FTP_TRANSFER_TYPE_BINARY 0x00000002 - -typedef DWORD OLE_COLOR; - -// Define the Windows Styles which are not defined by MS -#ifndef WS_POPUPWINDOW -#define WS_POPUPWINDOW WS_POPUP|WS_BORDER|WS_SYSMENU|WS_CAPTION -#endif - -#ifndef WS_OVERLAPPEDWINDOW -#define WS_OVERLAPPEDWINDOW WS_OVERLAPPED|WS_CAPTION|WS_SYSMENU|WS_THICKFRAME|WS_MINIMIZEBOX|WS_MAXIMIZEBOX -#endif - -#ifndef WS_TILED -#define WS_TILED WS_OVERLAPPED -#endif - -#ifndef WS_TILEDWINDOW -#define WS_TILEDWINDOW WS_OVERLAPPEDWINDOW -#endif - -#ifndef WS_EX_CAPTIONOKBTN -#define WS_EX_CAPTIONOKBTN 0x80000000L -#endif - -#ifndef WS_EX_NODRAG -#define WS_EX_NODRAG 0x40000000L -#endif - -#ifdef __cplusplus -} // Extern C. -#endif - -#ifdef __cplusplus - - -// As Windows CE lacks some standard functions used in Qt, these got -// reimplemented. Other projects do this as well. Inline functions are used -// that there is a central place to disable functions for newer versions if -// they get available. There are no defines used anymore, because this -// will break member functions of classes which are called like these -// functions. Also inline functions are only supported by C++, so just define -// them for C++, as only 3rd party dependencies are C, this is no issue. -// The other declarations available in this file are being used per -// define inside qplatformdefs.h of the corresponding WinCE mkspec. - -#define generate_inline_return_func0(funcname, returntype) \ - inline returntype funcname() \ - { \ - return qt_wince_##funcname(); \ - } -#define generate_inline_return_func1(funcname, returntype, param1) \ - inline returntype funcname(param1 p1) \ - { \ - return qt_wince_##funcname(p1); \ - } -#define generate_inline_return_func2(funcname, returntype, prependnamespace, param1, param2) \ - inline returntype funcname(param1 p1, param2 p2) \ - { \ - return prependnamespace##funcname(p1, p2); \ - } -#define generate_inline_return_func3(funcname, returntype, param1, param2, param3) \ - inline returntype funcname(param1 p1, param2 p2, param3 p3) \ - { \ - return qt_wince_##funcname(p1, p2, p3); \ - } -#define generate_inline_return_func4(funcname, returntype, prependnamespace, param1, param2, param3, param4) \ - inline returntype funcname(param1 p1, param2 p2, param3 p3, param4 p4) \ - { \ - return prependnamespace##funcname(p1, p2, p3, p4); \ - } -#define generate_inline_return_func5(funcname, returntype, param1, param2, param3, param4, param5) \ - inline returntype funcname(param1 p1, param2 p2, param3 p3, param4 p4, param5 p5) \ - { \ - return qt_wince_##funcname(p1, p2, p3, p4, p5); \ - } -#define generate_inline_return_func6(funcname, returntype, param1, param2, param3, param4, param5, param6) \ - inline returntype funcname(param1 p1, param2 p2, param3 p3, param4 p4, param5 p5, param6 p6) \ - { \ - return qt_wince_##funcname(p1, p2, p3, p4, p5, p6); \ - } -#define generate_inline_return_func7(funcname, returntype, param1, param2, param3, param4, param5, param6, param7) \ - inline returntype funcname(param1 p1, param2 p2, param3 p3, param4 p4, param5 p5, param6 p6, param7 p7) \ - { \ - return qt_wince_##funcname(p1, p2, p3, p4, p5, p6, p7); \ - } - -typedef unsigned (__stdcall *StartAdressExFunc)(void *); -typedef void(*StartAdressFunc)(void *); -typedef int ( __cdecl *CompareFunc ) (const void *, const void *) ; - -generate_inline_return_func4(getenv_s, errno_t, qt_fake_, size_t *, char *, size_t, const char *) -generate_inline_return_func2(_putenv_s, errno_t, qt_fake_, const char *, const char *) -generate_inline_return_func0(_getpid, int) -generate_inline_return_func1(time_tToFt, FILETIME, time_t) -generate_inline_return_func1(ftToTime_t, time_t, FILETIME) -generate_inline_return_func0(_getdrive, int) -generate_inline_return_func2(_waccess, int, qt_wince_, const wchar_t *, int) -generate_inline_return_func3(_wopen, int, const wchar_t *, int, int) -generate_inline_return_func2(_fdopen, FILE *, qt_wince_, int, const char *) -generate_inline_return_func2(fdopen, FILE *, qt_wince_, int, const char *) -generate_inline_return_func1(rewind, void, FILE *) -generate_inline_return_func0(tmpfile, FILE *) -generate_inline_return_func2(_rename, int, qt_wince_, const char *, const char *) -generate_inline_return_func1(_remove, int, const char *) -generate_inline_return_func1(SetErrorMode, int, int) -#if _WIN32_WCE < 0x800 -generate_inline_return_func2(_chmod, bool, qt_wince_, const char *, int) -generate_inline_return_func2(_wchmod, bool, qt_wince_, const wchar_t *, int) -#endif -generate_inline_return_func7(CreateFileA, HANDLE, LPCSTR, DWORD, DWORD, LPSECURITY_ATTRIBUTES, DWORD, DWORD, HANDLE) -generate_inline_return_func4(SetWindowOrgEx, BOOL, qt_wince_, HDC, int, int, LPPOINT) -generate_inline_return_func2(calloc, void *, qt_wince_, size_t, size_t) -generate_inline_return_func0(GetThreadLocale, DWORD) -generate_inline_return_func3(_beginthread, HANDLE, StartAdressFunc, unsigned, void *) -generate_inline_return_func6(_beginthreadex, unsigned long, void *, unsigned, StartAdressExFunc, void *, unsigned, unsigned *) -generate_inline_return_func1(_endthreadex, void, unsigned) -generate_inline_return_func5(bsearch, void *, const void *, const void *, size_t, size_t, CompareFunc) - -#endif //__cplusplus - -#endif // Q_OS_WINCE -#endif // QFUNCTIONS_WINCE_H diff --git a/src/corelib/kernel/qsharedmemory_win.cpp b/src/corelib/kernel/qsharedmemory_win.cpp index e998b938c7..07d4930332 100644 --- a/src/corelib/kernel/qsharedmemory_win.cpp +++ b/src/corelib/kernel/qsharedmemory_win.cpp @@ -64,8 +64,8 @@ void QSharedMemoryPrivate::setErrorString(QLatin1String function) errorString = QSharedMemory::tr("%1: already exists").arg(function); break; case ERROR_FILE_NOT_FOUND: -#if defined(Q_OS_WINCE) || (defined(Q_OS_WINRT) && _MSC_VER < 1900) - // This happens on CE only if no file is present as CreateFileMappingW +#if defined(Q_OS_WINRT) && _MSC_VER < 1900 + // This happens on WinRT only if no file is present as CreateFileMappingW // bails out with this error code case ERROR_INVALID_PARAMETER: #endif @@ -112,10 +112,6 @@ HANDLE QSharedMemoryPrivate::handle() #else hand = CreateFileMappingFromApp(INVALID_HANDLE_VALUE, 0, PAGE_READWRITE, 0, (PCWSTR)nativeKey.utf16()); #endif -#elif defined(Q_OS_WINCE) - // This works for opening a mapping too, but always opens it with read/write access in - // attach as it seems. - hand = CreateFileMapping(INVALID_HANDLE_VALUE, 0, PAGE_READWRITE, 0, 0, (wchar_t*)nativeKey.utf16()); #else hand = OpenFileMapping(FILE_MAP_ALL_ACCESS, false, (wchar_t*)nativeKey.utf16()); #endif diff --git a/src/corelib/kernel/qsystemerror.cpp b/src/corelib/kernel/qsystemerror.cpp index 12fd5404da..f38daec4f8 100644 --- a/src/corelib/kernel/qsystemerror.cpp +++ b/src/corelib/kernel/qsystemerror.cpp @@ -39,15 +39,9 @@ #include <qglobal.h> #include "qsystemerror_p.h" -#if !defined(Q_OS_WINCE) -# include <errno.h> -# if defined(Q_CC_MSVC) -# include <crtdbg.h> -# endif -#else -# if (_WIN32_WCE >= 0x700) -# include <errno.h> -# endif +#include <errno.h> +#if defined(Q_CC_MSVC) +# include <crtdbg.h> #endif #ifdef Q_OS_WIN # include <qt_windows.h> @@ -131,16 +125,12 @@ static QString standardLibraryErrorString(int errorCode) s = QT_TRANSLATE_NOOP("QIODevice", "No space left on device"); break; default: { - #ifdef Q_OS_WINCE - ret = windowsErrorString(errorCode); - #else - #if !defined(QT_NO_THREAD) && defined(_POSIX_THREAD_SAFE_FUNCTIONS) && _POSIX_VERSION >= 200112L && !defined(Q_OS_INTEGRITY) && !defined(Q_OS_QNX) + #if !defined(QT_NO_THREAD) && defined(_POSIX_THREAD_SAFE_FUNCTIONS) && _POSIX_VERSION >= 200112L && !defined(Q_OS_INTEGRITY) && !defined(Q_OS_QNX) QByteArray buf(1024, '\0'); ret = fromstrerror_helper(strerror_r(errorCode, buf.data(), buf.size()), buf); - #else + #else ret = QString::fromLocal8Bit(strerror(errorCode)); - #endif - #endif + #endif break; } } if (s) { diff --git a/src/corelib/kernel/qsystemsemaphore_p.h b/src/corelib/kernel/qsystemsemaphore_p.h index 26647db2e1..3b55d80276 100644 --- a/src/corelib/kernel/qsystemsemaphore_p.h +++ b/src/corelib/kernel/qsystemsemaphore_p.h @@ -56,9 +56,7 @@ #ifndef QT_NO_SYSTEMSEMAPHORE #include "qsharedmemory_p.h" -#ifndef Q_OS_WINCE -# include <sys/types.h> -#endif +#include <sys/types.h> #ifdef QT_POSIX_IPC # include <semaphore.h> #endif diff --git a/src/corelib/kernel/qsystemsemaphore_win.cpp b/src/corelib/kernel/qsystemsemaphore_win.cpp index 236e346afe..3395f5641e 100644 --- a/src/corelib/kernel/qsystemsemaphore_win.cpp +++ b/src/corelib/kernel/qsystemsemaphore_win.cpp @@ -121,11 +121,7 @@ bool QSystemSemaphorePrivate::modifySemaphore(int count) return false; } } else { -#if !defined(Q_OS_WINCE) if (WAIT_OBJECT_0 != WaitForSingleObjectEx(semaphore, INFINITE, FALSE)) { -#else - if (WAIT_OBJECT_0 != WaitForSingleObject(semaphore, INFINITE)) { -#endif setErrorString(QLatin1String("QSystemSemaphore::modifySemaphore")); #if defined QSYSTEMSEMAPHORE_DEBUG qDebug("QSystemSemaphore::modifySemaphore WaitForSingleObject failed"); diff --git a/src/corelib/plugin/qlibrary_win.cpp b/src/corelib/plugin/qlibrary_win.cpp index deec54db0a..982035b49b 100644 --- a/src/corelib/plugin/qlibrary_win.cpp +++ b/src/corelib/plugin/qlibrary_win.cpp @@ -71,15 +71,6 @@ bool QLibraryPrivate::load_sys() #endif // We make the following attempts at locating the library: // - // WinCE - // if (absolute) - // fileName - // fileName + ".dll" - // else - // fileName + ".dll" - // fileName - // QFileInfo(fileName).absoluteFilePath() - // // Windows // if (absolute) // fileName @@ -97,14 +88,10 @@ bool QLibraryPrivate::load_sys() // If the fileName is an absolute path we try that first, otherwise we // use the system-specific suffix first QFileSystemEntry fsEntry(fileName); - if (fsEntry.isAbsolute()) { + if (fsEntry.isAbsolute()) attempts.prepend(fileName); - } else { + else attempts.append(fileName); -#if defined(Q_OS_WINCE) - attempts.append(QFileInfo(fileName).absoluteFilePath()); -#endif - } #ifdef Q_OS_WINRT if (fileName.startsWith(QLatin1Char('/'))) attempts.prepend(QDir::rootPath() + fileName); @@ -165,11 +152,7 @@ bool QLibraryPrivate::unload_sys() QFunctionPointer QLibraryPrivate::resolve_sys(const char* symbol) { -#ifdef Q_OS_WINCE - FARPROC address = GetProcAddress(pHnd, (const wchar_t*)QString::fromLatin1(symbol).utf16()); -#else FARPROC address = GetProcAddress(pHnd, symbol); -#endif if (!address) { errorString = QLibrary::tr("Cannot resolve symbol \"%1\" in %2: %3").arg( QString::fromLatin1(symbol)).arg( diff --git a/src/corelib/plugin/qsystemlibrary.cpp b/src/corelib/plugin/qsystemlibrary.cpp index 178a33f987..7c80fbbd42 100644 --- a/src/corelib/plugin/qsystemlibrary.cpp +++ b/src/corelib/plugin/qsystemlibrary.cpp @@ -68,23 +68,11 @@ DLL Safe search mode is documented in the "Dynamic-Link Library Search Order" document on MSDN. - - Since library loading code is sometimes shared between Windows and WinCE, - this class can also be used on WinCE. However, its implementation just - calls the LoadLibrary() function. This is ok since it is documented as not - loading from the current directory on WinCE. This behaviour is documented - in the documentation for LoadLibrary for Windows CE at MSDN. - (http://msdn.microsoft.com/en-us/library/ms886736.aspx) */ QT_BEGIN_NAMESPACE -#if defined(Q_OS_WINCE) -HINSTANCE QSystemLibrary::load(const wchar_t *libraryName, bool onlySystemDirectory /* = true */) -{ - return ::LoadLibrary(libraryName); -} -#elif defined(Q_OS_WINRT) +#if defined(Q_OS_WINRT) HINSTANCE QSystemLibrary::load(const wchar_t *libraryName, bool onlySystemDirectory /* = true */) { Q_UNUSED(onlySystemDirectory); @@ -141,6 +129,6 @@ HINSTANCE QSystemLibrary::load(const wchar_t *libraryName, bool onlySystemDirect } -#endif //Q_OS_WINCE +#endif // Q_OS_WINRT QT_END_NAMESPACE diff --git a/src/corelib/plugin/qsystemlibrary_p.h b/src/corelib/plugin/qsystemlibrary_p.h index 469376d81b..7b6d180df9 100644 --- a/src/corelib/plugin/qsystemlibrary_p.h +++ b/src/corelib/plugin/qsystemlibrary_p.h @@ -93,11 +93,7 @@ public: load(); if (!m_handle) return 0; -#ifdef Q_OS_WINCE - return QFunctionPointer(GetProcAddress(m_handle, (const wchar_t*)QString::fromLatin1(symbol).utf16())); -#else return QFunctionPointer(GetProcAddress(m_handle, symbol)); -#endif } static QFunctionPointer resolve(const QString &libraryName, const char *symbol) diff --git a/src/corelib/thread/qmutex_win.cpp b/src/corelib/thread/qmutex_win.cpp index acb0f9dc61..3c314a4c0c 100644 --- a/src/corelib/thread/qmutex_win.cpp +++ b/src/corelib/thread/qmutex_win.cpp @@ -61,11 +61,7 @@ QMutexPrivate::~QMutexPrivate() bool QMutexPrivate::wait(int timeout) { -#ifndef Q_OS_WINCE return (WaitForSingleObjectEx(event, timeout < 0 ? INFINITE : timeout, FALSE) == WAIT_OBJECT_0); -#else - return (WaitForSingleObject(event, timeout < 0 ? INFINITE : timeout) == WAIT_OBJECT_0); -#endif } void QMutexPrivate::wakeUp() Q_DECL_NOTHROW diff --git a/src/corelib/thread/qthread_win.cpp b/src/corelib/thread/qthread_win.cpp index ef1799a021..74e191f889 100644 --- a/src/corelib/thread/qthread_win.cpp +++ b/src/corelib/thread/qthread_win.cpp @@ -55,15 +55,10 @@ #include <qt_windows.h> #ifndef Q_OS_WINRT -#ifndef Q_OS_WINCE -#ifndef _MT -#define _MT -#endif // _MT -#include <process.h> -#else // !Q_OS_WINCE -#include "qfunctions_wince.h" -#endif // Q_OS_WINCE -#else // !Q_OS_WINRT +# ifndef _MT +# define _MT +# endif // _MT +# include <process.h> #endif // Q_OS_WINRT #ifndef QT_NO_THREAD @@ -150,7 +145,6 @@ QThreadData *QThreadData::current(bool createIfNecessary) // WinRT API? } else { HANDLE realHandle = INVALID_HANDLE_VALUE; -#if !defined(Q_OS_WINCE) || (defined(_WIN32_WCE) && (_WIN32_WCE>=0x600)) DuplicateHandle(GetCurrentProcess(), GetCurrentThread(), GetCurrentProcess(), @@ -158,9 +152,6 @@ QThreadData *QThreadData::current(bool createIfNecessary) 0, FALSE, DUPLICATE_SAME_ACCESS); -#else - realHandle = reinterpret_cast<HANDLE>(GetCurrentThreadId()); -#endif qt_watch_adopted_thread(realHandle, threadData->thread); } } @@ -190,9 +181,7 @@ void qt_watch_adopted_thread(const HANDLE adoptedThreadHandle, QThread *qthread) QMutexLocker lock(&qt_adopted_thread_watcher_mutex); if (GetCurrentThreadId() == qt_adopted_thread_watcher_id) { -#if !defined(Q_OS_WINCE) || (defined(_WIN32_WCE) && (_WIN32_WCE>=0x600)) CloseHandle(adoptedThreadHandle); -#endif return; } @@ -291,9 +280,7 @@ DWORD WINAPI qt_adopted_thread_watcher_function(LPVOID) data->deref(); QMutexLocker lock(&qt_adopted_thread_watcher_mutex); -#if !defined(Q_OS_WINCE) || (defined(_WIN32_WCE) && (_WIN32_WCE>=0x600)) CloseHandle(qt_adopted_thread_handles.at(handleIndex)); -#endif qt_adopted_thread_handles.remove(handleIndex); qt_adopted_qthreads.remove(qthreadIndex); } @@ -306,7 +293,7 @@ DWORD WINAPI qt_adopted_thread_watcher_function(LPVOID) return 0; } -#if !defined(QT_NO_DEBUG) && defined(Q_CC_MSVC) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#if !defined(QT_NO_DEBUG) && defined(Q_CC_MSVC) && !defined(Q_OS_WINRT) #ifndef Q_OS_WIN64 # define ULONG_PTR DWORD @@ -336,7 +323,7 @@ void qt_set_thread_name(HANDLE threadId, LPCSTR threadName) { } } -#endif // !QT_NO_DEBUG && Q_CC_MSVC && !Q_OS_WINCE && !Q_OS_WINRT +#endif // !QT_NO_DEBUG && Q_CC_MSVC && !Q_OS_WINRT /************************************************************************** ** QThreadPrivate @@ -378,7 +365,7 @@ unsigned int __stdcall QT_ENSURE_STACK_ALIGNED_FOR_SSE QThreadPrivate::start(voi else createEventDispatcher(data); -#if !defined(QT_NO_DEBUG) && defined(Q_CC_MSVC) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#if !defined(QT_NO_DEBUG) && defined(Q_CC_MSVC) && !defined(Q_OS_WINRT) // sets the name of the current thread. QByteArray objectName = thr->objectName().toLocal8Bit(); qt_set_thread_name((HANDLE)-1, @@ -453,7 +440,7 @@ int QThread::idealThreadCount() Q_DECL_NOTHROW void QThread::yieldCurrentThread() { -#if !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#if !defined(Q_OS_WINRT) SwitchToThread(); #else ::Sleep(0); diff --git a/src/corelib/thread/qwaitcondition_win.cpp b/src/corelib/thread/qwaitcondition_win.cpp index f3a645c504..34db71808d 100644 --- a/src/corelib/thread/qwaitcondition_win.cpp +++ b/src/corelib/thread/qwaitcondition_win.cpp @@ -115,12 +115,7 @@ bool QWaitConditionPrivate::wait(QWaitConditionEvent *wce, unsigned long time) { // wait for the event bool ret = false; -#ifndef Q_OS_WINCE switch (WaitForSingleObjectEx(wce->event, time, FALSE)) { -#else - switch (WaitForSingleObject(wce->event, time)) { -#endif - default: break; case WAIT_OBJECT_0: diff --git a/src/corelib/tools/qcommandlineparser.cpp b/src/corelib/tools/qcommandlineparser.cpp index 81568681d8..c0bd132fc3 100644 --- a/src/corelib/tools/qcommandlineparser.cpp +++ b/src/corelib/tools/qcommandlineparser.cpp @@ -44,7 +44,7 @@ #include <qhash.h> #include <qvector.h> #include <qdebug.h> -#if defined(Q_OS_WIN) && !defined(QT_BOOTSTRAPPED) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) && !defined(QT_BOOTSTRAPPED) && !defined(Q_OS_WINRT) # include <qt_windows.h> #endif #include <stdio.h> @@ -532,7 +532,7 @@ QString QCommandLineParser::errorText() const enum MessageType { UsageMessage, ErrorMessage }; -#if defined(Q_OS_WIN) && !defined(QT_BOOTSTRAPPED) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) && !defined(QT_BOOTSTRAPPED) && !defined(Q_OS_WINRT) // Return whether to use a message box. Use handles if a console can be obtained // or we are run with redirected handles (for example, by QProcess). static inline bool displayMessageBox() @@ -554,7 +554,7 @@ static void showParserMessage(const QString &message, MessageType type) else qCritical(qPrintable(message)); return; -#elif defined(Q_OS_WIN) && !defined(QT_BOOTSTRAPPED) && !defined(Q_OS_WINCE) +#elif defined(Q_OS_WIN) && !defined(QT_BOOTSTRAPPED) if (displayMessageBox()) { const UINT flags = MB_OK | MB_TOPMOST | MB_SETFOREGROUND | (type == UsageMessage ? MB_ICONINFORMATION : MB_ICONERROR); @@ -567,7 +567,7 @@ static void showParserMessage(const QString &message, MessageType type) reinterpret_cast<const wchar_t *>(title.utf16()), flags); return; } -#endif // Q_OS_WIN && !QT_BOOTSTRAPPED && !Q_OS_WINCE +#endif // Q_OS_WIN && !QT_BOOTSTRAPPED fputs(qPrintable(message), type == UsageMessage ? stdout : stderr); } diff --git a/src/corelib/tools/qdatetime.cpp b/src/corelib/tools/qdatetime.cpp index e794da8326..4e90624ebe 100644 --- a/src/corelib/tools/qdatetime.cpp +++ b/src/corelib/tools/qdatetime.cpp @@ -57,9 +57,6 @@ #include <time.h> #ifdef Q_OS_WIN # include <qt_windows.h> -# ifdef Q_OS_WINCE -# include "qfunctions_wince.h" -# endif # ifdef Q_OS_WINRT # include "qfunctions_winrt.h" # endif @@ -1682,9 +1679,6 @@ QString QTime::toString(const QString& format) const bool QTime::setHMS(int h, int m, int s, int ms) { -#if defined(Q_OS_WINCE) - startTick = NullTime; -#endif if (!isValid(h,m,s,ms)) { mds = NullTime; // make this invalid return false; @@ -1764,10 +1758,6 @@ QTime QTime::addMSecs(int ms) const t.mds = (ds() + ms) % MSECS_PER_DAY; } } -#if defined(Q_OS_WINCE) - if (startTick > NullTime) - t.startTick = (startTick + ms) % MSECS_PER_DAY; -#endif return t; } @@ -1789,13 +1779,7 @@ int QTime::msecsTo(const QTime &t) const { if (!isValid() || !t.isValid()) return 0; -#if defined(Q_OS_WINCE) - // GetLocalTime() for Windows CE has no milliseconds resolution - if (t.startTick > NullTime && startTick > NullTime) - return t.startTick - startTick; - else -#endif - return t.ds() - ds(); + return t.ds() - ds(); } @@ -2137,10 +2121,7 @@ int QTime::elapsed() const // Calls the platform variant of tzset static void qt_tzset() { -#if defined(Q_OS_WINCE) - // WinCE doesn't use tzset - return; -#elif defined(Q_OS_WIN) +#if defined(Q_OS_WIN) _tzset(); #else tzset(); @@ -2154,12 +2135,7 @@ static void qt_tzset() // Relies on tzset, mktime, or localtime having been called to populate timezone static int qt_timezone() { -#if defined(Q_OS_WINCE) - TIME_ZONE_INFORMATION tzi; - GetTimeZoneInformation(&tzi); - // Expressed in minutes, convert to seconds - return (tzi.Bias + tzi.StandardBias) * 60; -#elif defined(_MSC_VER) && _MSC_VER >= 1400 +#if defined(_MSC_VER) long offset; _get_timezone(&offset); return offset; @@ -2186,16 +2162,6 @@ static int qt_timezone() // Returns the tzname, assume tzset has been called already static QString qt_tzname(QDateTimePrivate::DaylightStatus daylightStatus) { -#if defined(Q_OS_WINCE) - TIME_ZONE_INFORMATION tzi; - DWORD res = GetTimeZoneInformation(&tzi); - if (res == TIME_ZONE_ID_UNKNOWN) - return QString(); - else if (daylightStatus == QDateTimePrivate::DaylightTime) - return QString::fromWCharArray(tzi.DaylightName); - else - return QString::fromWCharArray(tzi.StandardName); -#else int isDst = (daylightStatus == QDateTimePrivate::DaylightTime) ? 1 : 0; #if defined(_MSC_VER) && _MSC_VER >= 1400 size_t s = 0; @@ -2206,7 +2172,6 @@ static QString qt_tzname(QDateTimePrivate::DaylightStatus daylightStatus) #else return QString::fromLocal8Bit(tzname[isDst]); #endif // Q_OS_WIN -#endif // Q_OS_WINCE } // Calls the platform variant of mktime for the given date, time and daylightStatus, @@ -2221,48 +2186,6 @@ static qint64 qt_mktime(QDate *date, QTime *time, QDateTimePrivate::DaylightStat int yy, mm, dd; date->getDate(&yy, &mm, &dd); -#if defined(Q_OS_WINCE) - // WinCE doesn't provide standard C library time functions - SYSTEMTIME st; - memset(&st, 0, sizeof(SYSTEMTIME)); - st.wSecond = time->second(); - st.wMinute = time->minute(); - st.wHour = time->hour(); - st.wDay = dd; - st.wMonth = mm; - st.wYear = yy; - FILETIME lft; - bool valid = SystemTimeToFileTime(&st, &lft); - FILETIME ft; - if (valid) - valid = LocalFileTimeToFileTime(&lft, &ft); - const time_t secsSinceEpoch = ftToTime_t(ft); - const time_t localSecs = ftToTime_t(lft); - TIME_ZONE_INFORMATION tzi; - GetTimeZoneInformation(&tzi); - bool isDaylight = false; - // Check for overflow - qint64 localDiff = qAbs(localSecs - secsSinceEpoch); - int daylightOffset = qAbs(tzi.Bias + tzi.DaylightBias) * 60; - if (localDiff > daylightOffset) - valid = false; - else - isDaylight = (localDiff == daylightOffset); - if (daylightStatus) { - if (isDaylight) - *daylightStatus = QDateTimePrivate::DaylightTime; - else - *daylightStatus = QDateTimePrivate::StandardTime; - } - if (abbreviation) { - if (isDaylight) - *abbreviation = QString::fromWCharArray(tzi.DaylightName); - else - *abbreviation = QString::fromWCharArray(tzi.StandardName); - } - if (ok) - *ok = valid; -#else // All other platforms provide standard C library time functions tm local; memset(&local, 0, sizeof(local)); // tm_[wy]day plus any non-standard fields @@ -2324,7 +2247,6 @@ static qint64 qt_mktime(QDate *date, QTime *time, QDateTimePrivate::DaylightStat if (ok) *ok = false; } -#endif // Q_OS_WINCE return ((qint64)secsSinceEpoch * 1000) + msec; } @@ -2340,23 +2262,7 @@ static bool qt_localtime(qint64 msecsSinceEpoch, QDate *localDate, QTime *localT tm local; bool valid = false; -#if defined(Q_OS_WINCE) - FILETIME utcTime = time_tToFt(secsSinceEpoch); - FILETIME resultTime; - valid = FileTimeToLocalFileTime(&utcTime , &resultTime); - SYSTEMTIME sysTime; - if (valid) - valid = FileTimeToSystemTime(&resultTime , &sysTime); - - if (valid) { - local.tm_sec = sysTime.wSecond; - local.tm_min = sysTime.wMinute; - local.tm_hour = sysTime.wHour; - local.tm_mday = sysTime.wDay; - local.tm_mon = sysTime.wMonth - 1; - local.tm_year = sysTime.wYear - 1900; - } -#elif !defined(QT_NO_THREAD) && defined(_POSIX_THREAD_SAFE_FUNCTIONS) +#if !defined(QT_NO_THREAD) && defined(_POSIX_THREAD_SAFE_FUNCTIONS) // localtime() is required to work as if tzset() was called before it. // localtime_r() does not have this requirement, so make an explicit call. qt_tzset(); @@ -4104,9 +4010,6 @@ QTime QTime::currentTime() memset(&st, 0, sizeof(SYSTEMTIME)); GetLocalTime(&st); ct.setHMS(st.wHour, st.wMinute, st.wSecond, st.wMilliseconds); -#if defined(Q_OS_WINCE) - ct.startTick = GetTickCount() % MSECS_PER_DAY; -#endif return ct; } diff --git a/src/corelib/tools/qdatetime.h b/src/corelib/tools/qdatetime.h index 7955160c93..a9271ef177 100644 --- a/src/corelib/tools/qdatetime.h +++ b/src/corelib/tools/qdatetime.h @@ -148,15 +148,9 @@ Q_DECLARE_TYPEINFO(QDate, Q_MOVABLE_TYPE); class Q_CORE_EXPORT QTime { explicit Q_DECL_CONSTEXPR QTime(int ms) : mds(ms) -#if defined(Q_OS_WINCE) - , startTick(NullTime) -#endif {} public: Q_DECL_CONSTEXPR QTime(): mds(NullTime) -#if defined(Q_OS_WINCE) - , startTick(NullTime) -#endif {} QTime(int h, int m, int s = 0, int ms = 0); @@ -202,9 +196,6 @@ private: enum TimeFlag { NullTime = -1 }; Q_DECL_CONSTEXPR inline int ds() const { return mds == -1 ? 0 : mds; } int mds; -#if defined(Q_OS_WINCE) - int startTick; -#endif friend class QDateTime; friend class QDateTimePrivate; diff --git a/src/corelib/tools/qelapsedtimer_win.cpp b/src/corelib/tools/qelapsedtimer_win.cpp index 734aaf80f2..532d61d504 100644 --- a/src/corelib/tools/qelapsedtimer_win.cpp +++ b/src/corelib/tools/qelapsedtimer_win.cpp @@ -58,13 +58,13 @@ static void resolveLibs() if (done) return; -#if !defined(Q_OS_WINRT) && !defined(Q_OS_WINCE) +#if !defined(Q_OS_WINRT) // try to get GetTickCount64 from the system HMODULE kernel32 = GetModuleHandleW(L"kernel32"); if (!kernel32) return; ptrGetTickCount64 = (PtrGetTickCount64)GetProcAddress(kernel32, "GetTickCount64"); -#endif // !Q_OS_WINRT && !Q_OS_WINCE +#endif // !Q_OS_WINRT // Retrieve the number of high-resolution performance counter ticks per second LARGE_INTEGER frequency; diff --git a/src/corelib/tools/qlocale_win.cpp b/src/corelib/tools/qlocale_win.cpp index 88bfada515..b4598af45a 100644 --- a/src/corelib/tools/qlocale_win.cpp +++ b/src/corelib/tools/qlocale_win.cpp @@ -1161,19 +1161,16 @@ static QByteArray getWinLocaleName(LPWSTR id) } } -#if defined(Q_OS_WINCE) - result = winLangCodeToIsoName(id != LOCALE_USER_DEFAULT ? id : GetUserDefaultLCID()); -#else // !Q_OS_WINCE -# ifndef Q_OS_WINRT +#ifndef Q_OS_WINRT if (id == LOCALE_USER_DEFAULT) id = GetUserDefaultLCID(); -# else // !Q_OS_WINRT +#else // !Q_OS_WINRT WCHAR lcName[LOCALE_NAME_MAX_LENGTH]; if (QString::fromWCharArray(id) == QString::fromWCharArray(LOCALE_NAME_USER_DEFAULT)) { GetUserDefaultLocaleName(lcName, LOCALE_NAME_MAX_LENGTH); id = lcName; } -# endif // Q_OS_WINRT +#endif // Q_OS_WINRT QString resultuage = winIso639LangName(id); QString country = winIso3116CtryName(id); result = resultuage.toLatin1(); @@ -1181,7 +1178,6 @@ static QByteArray getWinLocaleName(LPWSTR id) result += '_'; result += country.toLatin1(); } -#endif // !Q_OS_WINCE return result; } diff --git a/src/corelib/tools/qsimd.cpp b/src/corelib/tools/qsimd.cpp index 9037442d9d..698189f9c6 100644 --- a/src/corelib/tools/qsimd.cpp +++ b/src/corelib/tools/qsimd.cpp @@ -48,16 +48,8 @@ #endif #if defined(Q_OS_WIN) -# if defined(Q_OS_WINCE) -# include <qt_windows.h> -# if _WIN32_WCE < 0x800 -# include <cmnintrin.h> -# endif -# endif # if !defined(Q_CC_GNU) -# ifndef Q_OS_WINCE -# include <intrin.h> -# endif +# include <intrin.h> # endif #elif defined(Q_OS_LINUX) && (defined(Q_PROCESSOR_ARM) || defined(Q_PROCESSOR_MIPS_32)) #include "private/qcore_unix_p.h" @@ -93,25 +85,6 @@ static inline uint detectProcessorFeatures() { return 0; } -#elif defined (Q_OS_WINCE) -static inline quint64 detectProcessorFeatures() -{ - quint64 features = 0; - -#if defined (ARM) -# ifdef PF_ARM_NEON - if (IsProcessorFeaturePresent(PF_ARM_NEON)) - features |= Q_UINT64_C(1) << CpuFeatureNEON; -# endif -#elif defined(_X86_) - if (IsProcessorFeaturePresent(PF_XMMI64_INSTRUCTIONS_AVAILABLE)) - features |= Q_UINT64_C(1) << CpuFeatureSSE2; - if (IsProcessorFeaturePresent(PF_SSE3_INSTRUCTIONS_AVAILABLE)) - features |= Q_UINT64_C(1) << CpuFeatureSSE3; -#endif - return features; -} - #elif defined(Q_PROCESSOR_ARM) static inline quint64 detectProcessorFeatures() { diff --git a/src/corelib/tools/qsimd_p.h b/src/corelib/tools/qsimd_p.h index 1a795a670d..00f29deb3e 100644 --- a/src/corelib/tools/qsimd_p.h +++ b/src/corelib/tools/qsimd_p.h @@ -139,7 +139,7 @@ * } */ -#if defined(__MINGW64_VERSION_MAJOR) || (defined(Q_CC_MSVC) && !defined(Q_OS_WINCE)) +#if defined(__MINGW64_VERSION_MAJOR) || defined(Q_CC_MSVC) #include <intrin.h> #endif @@ -483,7 +483,7 @@ static Q_ALWAYS_INLINE unsigned _bit_scan_forward(unsigned val) } #elif defined(Q_PROCESSOR_X86) // Bit scan functions for x86 -# if defined(Q_CC_MSVC) && !defined(Q_OS_WINCE) +# if defined(Q_CC_MSVC) // MSVC calls it _BitScanReverse and returns the carry flag, which we don't need static __forceinline unsigned long _bit_scan_reverse(uint val) { diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp index 5c6ce179d0..b4140a58c3 100644 --- a/src/corelib/tools/qstring.cpp +++ b/src/corelib/tools/qstring.cpp @@ -81,9 +81,6 @@ #ifdef Q_OS_WIN # include <qt_windows.h> -# ifdef Q_OS_WINCE -# include <winnls.h> -# endif #endif #ifdef truncate @@ -5518,7 +5515,7 @@ int QString::localeAwareCompare(const QString &other) const return localeAwareCompare_helper(constData(), length(), other.constData(), other.length()); } -#if defined(QT_USE_ICU) && !defined(Q_OS_WIN32) && !defined(Q_OS_WINCE) && !defined (Q_OS_MAC) +#if defined(QT_USE_ICU) && !defined(Q_OS_WIN32) && !defined(Q_OS_DARWIN) Q_GLOBAL_STATIC(QThreadStorage<QCollator>, defaultCollator) #endif @@ -5533,12 +5530,12 @@ int QString::localeAwareCompare_helper(const QChar *data1, int length1, if (length1 == 0 || length2 == 0) return ucstrcmp(data1, length1, data2, length2); -#if defined(Q_OS_WIN32) || defined(Q_OS_WINCE) -#ifndef Q_OS_WINRT +#if defined(Q_OS_WIN) +# ifndef Q_OS_WINRT int res = CompareString(GetUserDefaultLCID(), 0, (wchar_t*)data1, length1, (wchar_t*)data2, length2); -#else +# else int res = CompareStringEx(LOCALE_NAME_USER_DEFAULT, 0, (LPCWSTR)data1, length1, (LPCWSTR)data2, length2, NULL, NULL, 0); -#endif +# endif switch (res) { case CSTR_LESS_THAN: diff --git a/src/corelib/tools/qtimezoneprivate_win.cpp b/src/corelib/tools/qtimezoneprivate_win.cpp index f84b66fa99..a94161dd51 100644 --- a/src/corelib/tools/qtimezoneprivate_win.cpp +++ b/src/corelib/tools/qtimezoneprivate_win.cpp @@ -383,17 +383,11 @@ static void calculateTransitionsForYear(const QWinTimeZonePrivate::QWinTransitio static QLocale::Country userCountry() { -#if defined(Q_OS_WINCE) - // Guess that the syslem locale country is the right one to use - // TODO Find if WinCE has equivalent api - return QLocale::system().country(); -#else const GEOID id = GetUserGeoID(GEOCLASS_NATION); wchar_t code[3]; const int size = GetGeoInfo(id, GEO_ISO2, code, 3, 0); return (size == 3) ? QLocalePrivate::codeToCountry(QString::fromWCharArray(code)) : QLocale::AnyCountry; -#endif // Q_OS_WINCE } // Create the system default time zone |