diff options
author | Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> | 2016-03-23 10:25:46 +0100 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> | 2016-03-30 11:22:47 +0000 |
commit | 7fc2864dc5391096a19c2d5f80695129c24cc303 (patch) | |
tree | cd52ea13882972c24fca1cdd032ecd7e92725df5 /src/corelib/kernel | |
parent | 04aa760711602d3891d1f7f71e7f27911ff80d97 (diff) |
QtCore: Remove Windows CE.
Remove QSysInfo::WV_CE_5/6 enumeration values, #ifdef sections for Q_OS_WINCE
and wince .pro file clauses in library, examples and tests.
Task-number: QTBUG-51673
Change-Id: Ib63463445f3a26e04d018b193e4655030002f5f9
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
Diffstat (limited to 'src/corelib/kernel')
-rw-r--r-- | src/corelib/kernel/kernel.pri | 8 | ||||
-rw-r--r-- | src/corelib/kernel/qcoreapplication.cpp | 8 | ||||
-rw-r--r-- | src/corelib/kernel/qcoreapplication_win.cpp | 31 | ||||
-rw-r--r-- | src/corelib/kernel/qcorecmdlineargs_p.h | 88 | ||||
-rw-r--r-- | src/corelib/kernel/qeventdispatcher_win.cpp | 218 | ||||
-rw-r--r-- | src/corelib/kernel/qfunctions_p.h | 4 | ||||
-rw-r--r-- | src/corelib/kernel/qfunctions_wince.cpp | 407 | ||||
-rw-r--r-- | src/corelib/kernel/qfunctions_wince.h | 473 | ||||
-rw-r--r-- | src/corelib/kernel/qsharedmemory_win.cpp | 8 | ||||
-rw-r--r-- | src/corelib/kernel/qsystemerror.cpp | 22 | ||||
-rw-r--r-- | src/corelib/kernel/qsystemsemaphore_p.h | 4 | ||||
-rw-r--r-- | src/corelib/kernel/qsystemsemaphore_win.cpp | 4 |
12 files changed, 14 insertions, 1261 deletions
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"); |