From 7fc2864dc5391096a19c2d5f80695129c24cc303 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 23 Mar 2016 10:25:46 +0100 Subject: QtCore: Remove Windows CE. Remove QSysInfo::WV_CE_5/6 enumeration values, #ifdef sections for Q_OS_WINCE and wince .pro file clauses in library, examples and tests. Task-number: QTBUG-51673 Change-Id: Ib63463445f3a26e04d018b193e4655030002f5f9 Reviewed-by: Lars Knoll --- src/corelib/tools/qcommandlineparser.cpp | 8 +-- src/corelib/tools/qdatetime.cpp | 105 ++--------------------------- src/corelib/tools/qdatetime.h | 9 --- src/corelib/tools/qelapsedtimer_win.cpp | 4 +- src/corelib/tools/qlocale_win.cpp | 10 +-- src/corelib/tools/qsimd.cpp | 29 +------- src/corelib/tools/qsimd_p.h | 4 +- src/corelib/tools/qstring.cpp | 13 ++-- src/corelib/tools/qtimezoneprivate_win.cpp | 6 -- 9 files changed, 21 insertions(+), 167 deletions(-) (limited to 'src/corelib/tools') 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 #include #include -#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 #endif #include @@ -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(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 #ifdef Q_OS_WIN # include -# 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 -# if _WIN32_WCE < 0x800 -# include -# endif -# endif # if !defined(Q_CC_GNU) -# ifndef Q_OS_WINCE -# include -# endif +# include # 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 #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 -# ifdef Q_OS_WINCE -# include -# 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, 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 -- cgit v1.2.3