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>
This commit is contained in:
parent
04aa760711
commit
7fc2864dc5
@ -3,4 +3,4 @@ requires(qtHaveModule(widgets))
|
||||
TEMPLATE = subdirs
|
||||
# no QSharedMemory
|
||||
!vxworks:SUBDIRS = sharedmemory
|
||||
!wince:qtHaveModule(network): SUBDIRS += localfortuneserver localfortuneclient
|
||||
qtHaveModule(network): SUBDIRS += localfortuneserver localfortuneclient
|
||||
|
@ -74,8 +74,6 @@
|
||||
#else
|
||||
#undef DOUBLE_CONVERSION_CORRECT_DOUBLE_OPERATIONS
|
||||
#endif // _WIN32
|
||||
#elif defined(WINCE) || defined(_WIN32_WCE)
|
||||
#define DOUBLE_CONVERSION_CORRECT_DOUBLE_OPERATIONS 1
|
||||
#else
|
||||
#error Target architecture was not detected as supported by Double-Conversion.
|
||||
#endif
|
||||
|
@ -1,4 +1,4 @@
|
||||
win32|wince:HEADERS += arch/qatomic_msvc.h
|
||||
win32:HEADERS += arch/qatomic_msvc.h
|
||||
|
||||
HEADERS += \
|
||||
arch/qatomic_bootstrap.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)
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
@ -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
|
||||
|
@ -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) {
|
||||
|
@ -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.
|
||||
*/
|
||||
|
||||
/*!
|
||||
@ -1279,13 +1277,6 @@ bool qSharedBuild() Q_DECL_NOTHROW
|
||||
Defined on 64-bit versions of Windows.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\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");
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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>
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
||||
|
@ -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 \
|
||||
|
@ -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
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -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;
|
||||
|
@ -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();
|
||||
|
@ -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");
|
||||
|
@ -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)
|
||||
|
@ -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
|
@ -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:
|
||||
;
|
||||
}
|
||||
|
@ -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) {
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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)
|
||||
|
@ -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>
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
|
@ -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
|
||||
|
||||
|
@ -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[])
|
||||
{
|
||||
|
@ -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));
|
||||
}
|
||||
}
|
||||
|
@ -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"
|
||||
|
@ -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
|
@ -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
|
@ -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
|
||||
|
@ -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) {
|
||||
|
@ -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
|
||||
|
@ -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");
|
||||
|
@ -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(
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
|
@ -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:
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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()
|
||||
{
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -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:
|
||||
|
@ -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
|
||||
|
@ -62,8 +62,8 @@ private slots:
|
||||
void tst_QParallelAnimationGroup::initTestCase()
|
||||
{
|
||||
qRegisterMetaType<QAbstractAnimation::State>("QAbstractAnimation::State");
|
||||
#if defined(Q_OS_MAC) || defined(Q_OS_WINCE)
|
||||
// give the mac/wince app start event queue time to clear
|
||||
#if defined(Q_OS_DARWIN)
|
||||
// give the Darwin app start event queue time to clear
|
||||
QTest::qWait(1000);
|
||||
#endif
|
||||
}
|
||||
|
@ -1,4 +1,2 @@
|
||||
TEMPLATE = subdirs
|
||||
SUBDIRS = test
|
||||
|
||||
!wince: SUBDIRS += echo
|
||||
SUBDIRS = test echo
|
||||
|
@ -2,7 +2,3 @@ CONFIG += testcase
|
||||
TARGET = tst_qtendian
|
||||
QT = core testlib
|
||||
SOURCES = tst_qtendian.cpp
|
||||
wince* { # QTBUG-37194 , internal compiler errors with MSVC2008 for Windows CE
|
||||
QMAKE_CFLAGS_RELEASE -= -O2
|
||||
QMAKE_CXXFLAGS_RELEASE -= -O2
|
||||
}
|
||||
|
@ -35,7 +35,7 @@ SUBDIRS=\
|
||||
qurlquery \
|
||||
qwinoverlappedionotifier \
|
||||
|
||||
!win32|wince* {
|
||||
!win32 {
|
||||
SUBDIRS -=\
|
||||
qwinoverlappedionotifier
|
||||
}
|
||||
|
@ -2,5 +2,3 @@ CONFIG += testcase
|
||||
TARGET = tst_largefile
|
||||
QT = core testlib
|
||||
SOURCES = tst_largefile.cpp
|
||||
|
||||
wince: SOURCES += $$QT_SOURCE_TREE/src/corelib/kernel/qfunctions_wince.cpp
|
||||
|
@ -39,18 +39,12 @@
|
||||
#include <cstdio>
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
#ifndef Q_OS_WINCE
|
||||
#include <io.h>
|
||||
#endif
|
||||
|
||||
#ifndef FSCTL_SET_SPARSE
|
||||
# include <qt_windows.h>
|
||||
# include <io.h>
|
||||
# ifndef FSCTL_SET_SPARSE
|
||||
// MinGW doesn't define this.
|
||||
#define FSCTL_SET_SPARSE (0x900C4)
|
||||
#endif
|
||||
|
||||
# define FSCTL_SET_SPARSE (0x900C4)
|
||||
# endif
|
||||
#endif // Q_OS_WIN
|
||||
|
||||
class tst_LargeFile
|
||||
|
@ -88,10 +88,8 @@ private slots:
|
||||
void stream_QPen_data();
|
||||
void stream_QPen();
|
||||
|
||||
#ifndef Q_OS_WINCE
|
||||
void stream_QPixmap_data();
|
||||
void stream_QPixmap();
|
||||
#endif
|
||||
|
||||
void stream_QPoint_data();
|
||||
void stream_QPoint();
|
||||
@ -123,10 +121,8 @@ private slots:
|
||||
void stream_qint64_data();
|
||||
void stream_qint64();
|
||||
|
||||
#ifndef Q_OS_WINCE
|
||||
void stream_QIcon_data();
|
||||
void stream_QIcon();
|
||||
#endif
|
||||
|
||||
void stream_QEasingCurve_data();
|
||||
void stream_QEasingCurve();
|
||||
@ -1542,24 +1538,16 @@ void tst_QDataStream::readQPen(QDataStream *s)
|
||||
|
||||
// pixmap testing is currently limited to one pixmap only.
|
||||
//
|
||||
#ifndef Q_OS_WINCE
|
||||
// Test depends on more memory than available on Qt/CE
|
||||
void tst_QDataStream::stream_QPixmap_data()
|
||||
{
|
||||
stream_data(1);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef Q_OS_WINCE
|
||||
// Test depends on more memory than available on Qt/CE
|
||||
void tst_QDataStream::stream_QPixmap()
|
||||
{
|
||||
STREAM_IMPL(QPixmap);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef Q_OS_WINCE
|
||||
// Test depends on more memory than available on Qt/CE
|
||||
void tst_QDataStream::stream_QIcon_data()
|
||||
{
|
||||
stream_data(1);
|
||||
@ -1569,7 +1557,6 @@ void tst_QDataStream::stream_QIcon()
|
||||
{
|
||||
STREAM_IMPL(QIcon);
|
||||
}
|
||||
#endif
|
||||
|
||||
void tst_QDataStream::writeQPixmap(QDataStream *s)
|
||||
{
|
||||
@ -1844,7 +1831,7 @@ static QRegion qRegionData(int index)
|
||||
case 4: return QRegion(100, -100, 2048, 4096, QRegion::Rectangle);
|
||||
case 5: return QRegion(-100, 100, 4096, 2048, QRegion::Rectangle);
|
||||
case 6: return QRegion(0, 0, 0, 0, QRegion::Ellipse);
|
||||
#if (!defined(Q_OS_UNIX) && !defined(Q_OS_WINCE)) // all our Unix platforms use X regions.
|
||||
#if !defined(Q_OS_UNIX) // all our Unix platforms use X regions.
|
||||
case 7: return QRegion(1, 2, 300, 400, QRegion::Ellipse);
|
||||
case 8: return QRegion(100, 100, 1024, 768, QRegion::Ellipse);
|
||||
case 9: return QRegion(-100, -100, 1024, 1024, QRegion::Ellipse);
|
||||
@ -2496,12 +2483,10 @@ void tst_QDataStream::status_charptr_QByteArray_data()
|
||||
QTest::addColumn<int>("expectedStatus");
|
||||
QTest::addColumn<QByteArray>("expectedString");
|
||||
|
||||
#if !defined(Q_OS_WINCE)
|
||||
QByteArray oneMbMinus1(1024 * 1024 - 1, '\0');
|
||||
for (int i = 0; i < oneMbMinus1.size(); ++i)
|
||||
oneMbMinus1[i] = 0x1 | (8 * ((uchar)i / 9));
|
||||
QByteArray threeMbMinus1 = oneMbMinus1 + 'j' + oneMbMinus1 + 'k' + oneMbMinus1;
|
||||
#endif
|
||||
|
||||
// ok
|
||||
QTest::newRow("size 0") << QByteArray("\x00\x00\x00\x00", 4) << (int) QDataStream::Ok << QByteArray();
|
||||
@ -2510,14 +2495,12 @@ void tst_QDataStream::status_charptr_QByteArray_data()
|
||||
QTest::newRow("size 3") << QByteArray("\x00\x00\x00\x03jkl", 7) << (int) QDataStream::Ok << QByteArray("jkl");
|
||||
QTest::newRow("size 4") << QByteArray("\x00\x00\x00\x04jklm", 8) << (int) QDataStream::Ok << QByteArray("jklm");
|
||||
QTest::newRow("size 4j") << QByteArray("\x00\x00\x00\x04jklmj", 8) << (int) QDataStream::Ok << QByteArray("jklm");
|
||||
#if !defined(Q_OS_WINCE)
|
||||
QTest::newRow("size 1MB-1") << QByteArray("\x00\x0f\xff\xff", 4) + oneMbMinus1 + QByteArray("j") << (int) QDataStream::Ok << oneMbMinus1;
|
||||
QTest::newRow("size 1MB") << QByteArray("\x00\x10\x00\x00", 4) + oneMbMinus1 + QByteArray("jkl") << (int) QDataStream::Ok << oneMbMinus1 + "j";
|
||||
QTest::newRow("size 1MB+1") << QByteArray("\x00\x10\x00\x01", 4) + oneMbMinus1 + QByteArray("jkl") << (int) QDataStream::Ok << oneMbMinus1 + "jk";
|
||||
QTest::newRow("size 3MB-1") << QByteArray("\x00\x2f\xff\xff", 4) + threeMbMinus1 + QByteArray("j") << (int) QDataStream::Ok << threeMbMinus1;
|
||||
QTest::newRow("size 3MB") << QByteArray("\x00\x30\x00\x00", 4) + threeMbMinus1 + QByteArray("jkl") << (int) QDataStream::Ok << threeMbMinus1 + "j";
|
||||
QTest::newRow("size 3MB+1") << QByteArray("\x00\x30\x00\x01", 4) + threeMbMinus1 + QByteArray("jkl") << (int) QDataStream::Ok << threeMbMinus1 + "jk";
|
||||
#endif
|
||||
|
||||
// past end
|
||||
QTest::newRow("empty") << QByteArray() << (int) QDataStream::ReadPastEnd << QByteArray();
|
||||
@ -2530,12 +2513,10 @@ void tst_QDataStream::status_charptr_QByteArray_data()
|
||||
QTest::newRow("badsize 2") << QByteArray("\x00\x00\x00\x02j", 5) << (int) QDataStream::ReadPastEnd << QByteArray();
|
||||
QTest::newRow("badsize 3") << QByteArray("\x00\x00\x00\x03jk", 6) << (int) QDataStream::ReadPastEnd << QByteArray();
|
||||
QTest::newRow("badsize 4") << QByteArray("\x00\x00\x00\x04jkl", 7) << (int) QDataStream::ReadPastEnd << QByteArray();
|
||||
#if !defined(Q_OS_WINCE)
|
||||
QTest::newRow("badsize 1MB") << QByteArray("\x00\x10\x00\x00", 4) + oneMbMinus1 << (int) QDataStream::ReadPastEnd << QByteArray();
|
||||
QTest::newRow("badsize 1MB+1") << QByteArray("\x00\x10\x00\x01", 4) + oneMbMinus1 + QByteArray("j") << (int) QDataStream::ReadPastEnd << QByteArray();
|
||||
QTest::newRow("badsize 3MB") << QByteArray("\x00\x30\x00\x00", 4) + threeMbMinus1 << (int) QDataStream::ReadPastEnd << QByteArray();
|
||||
QTest::newRow("badsize 3MB+1") << QByteArray("\x00\x30\x00\x01", 4) + threeMbMinus1 + QByteArray("j") << (int) QDataStream::ReadPastEnd << QByteArray();
|
||||
#endif
|
||||
QTest::newRow("size -1") << QByteArray("\xff\xff\xff\xff", 4) << (int) QDataStream::ReadPastEnd << QByteArray();
|
||||
QTest::newRow("size -2") << QByteArray("\xff\xff\xff\xfe", 4) << (int) QDataStream::ReadPastEnd << QByteArray();
|
||||
}
|
||||
@ -2600,7 +2581,6 @@ void tst_QDataStream::status_QString_data()
|
||||
QTest::addColumn<int>("expectedStatus");
|
||||
QTest::addColumn<QString>("expectedString");
|
||||
|
||||
#if !defined(Q_OS_WINCE)
|
||||
QString oneMbMinus1;
|
||||
oneMbMinus1.resize(1024 * 1024 - 1);
|
||||
for (int i = 0; i < oneMbMinus1.size(); ++i)
|
||||
@ -2609,7 +2589,6 @@ void tst_QDataStream::status_QString_data()
|
||||
|
||||
QByteArray threeMbMinus1Data = qstring2qbytearray(threeMbMinus1);
|
||||
QByteArray oneMbMinus1Data = qstring2qbytearray(oneMbMinus1);
|
||||
#endif
|
||||
|
||||
// ok
|
||||
QTest::newRow("size 0") << QByteArray("\x00\x00\x00\x00", 4) << (int) QDataStream::Ok << QString();
|
||||
@ -2618,14 +2597,12 @@ void tst_QDataStream::status_QString_data()
|
||||
QTest::newRow("size 3") << QByteArray("\x00\x00\x00\x06\x00j\x00k\x00l", 10) << (int) QDataStream::Ok << QString("jkl");
|
||||
QTest::newRow("size 4") << QByteArray("\x00\x00\x00\x08\x00j\x00k\x00l\x00m", 12) << (int) QDataStream::Ok << QString("jklm");
|
||||
QTest::newRow("size 4j") << QByteArray("\x00\x00\x00\x08\x00j\x00k\x00l\x00mjj", 14) << (int) QDataStream::Ok << QString("jklm");
|
||||
#if !defined(Q_OS_WINCE)
|
||||
QTest::newRow("size 1MB-1") << QByteArray("\x00\x1f\xff\xfe", 4) + oneMbMinus1Data + QByteArray("jj") << (int) QDataStream::Ok << oneMbMinus1;
|
||||
QTest::newRow("size 1MB") << QByteArray("\x00\x20\x00\x00", 4) + oneMbMinus1Data + QByteArray("\x00j\x00k\x00l", 6) << (int) QDataStream::Ok << oneMbMinus1 + "j";
|
||||
QTest::newRow("size 1MB+1") << QByteArray("\x00\x20\x00\x02", 4) + oneMbMinus1Data + QByteArray("\x00j\x00k\x00l", 6) << (int) QDataStream::Ok << oneMbMinus1 + "jk";
|
||||
QTest::newRow("size 3MB-1") << QByteArray("\x00\x5f\xff\xfe", 4) + threeMbMinus1Data + QByteArray("jj") << (int) QDataStream::Ok << threeMbMinus1;
|
||||
QTest::newRow("size 3MB") << QByteArray("\x00\x60\x00\x00", 4) + threeMbMinus1Data + QByteArray("\x00j\x00k\x00l", 6) << (int) QDataStream::Ok << threeMbMinus1 + "j";
|
||||
QTest::newRow("size 3MB+1") << QByteArray("\x00\x60\x00\x02", 4) + threeMbMinus1Data + QByteArray("\x00j\x00k\x00l", 6) << (int) QDataStream::Ok << threeMbMinus1 + "jk";
|
||||
#endif
|
||||
|
||||
// past end
|
||||
QTest::newRow("empty") << QByteArray() << (int) QDataStream::ReadPastEnd << QString();
|
||||
@ -2638,14 +2615,12 @@ void tst_QDataStream::status_QString_data()
|
||||
QTest::newRow("badsize 2") << QByteArray("\x00\x00\x00\x04jj", 6) << (int) QDataStream::ReadPastEnd << QString();
|
||||
QTest::newRow("badsize 3") << QByteArray("\x00\x00\x00\x06jjkk", 8) << (int) QDataStream::ReadPastEnd << QString();
|
||||
QTest::newRow("badsize 4") << QByteArray("\x00\x00\x00\x08jjkkll", 10) << (int) QDataStream::ReadPastEnd << QString();
|
||||
#if !defined(Q_OS_WINCE)
|
||||
QTest::newRow("badsize 1MB") << QByteArray("\x00\x20\x00\x00", 4) + oneMbMinus1Data << (int) QDataStream::ReadPastEnd << QString();
|
||||
QTest::newRow("badsize 1MB+1") << QByteArray("\x00\x20\x00\x02", 4) + oneMbMinus1Data + QByteArray("j") << (int) QDataStream::ReadPastEnd << QString();
|
||||
QTest::newRow("badsize 3MB") << QByteArray("\x00\x60\x00\x00", 4) + threeMbMinus1Data << (int) QDataStream::ReadPastEnd << QString();
|
||||
QTest::newRow("badsize 3MB+1") << QByteArray("\x00\x60\x00\x02", 4) + threeMbMinus1Data + QByteArray("j") << (int) QDataStream::ReadPastEnd << QString();
|
||||
QTest::newRow("size -2") << QByteArray("\xff\xff\xff\xfe", 4) << (int) QDataStream::ReadPastEnd << QString();
|
||||
QTest::newRow("size MAX") << QByteArray("\x7f\xff\xff\xfe", 4) << (int) QDataStream::ReadPastEnd << QString();
|
||||
#endif
|
||||
|
||||
// corrupt data
|
||||
QTest::newRow("corrupt1") << QByteArray("yyyy") << (int) QDataStream::ReadCorruptData << QString();
|
||||
|
@ -35,7 +35,7 @@
|
||||
#include <qregexp.h>
|
||||
#include <qstringlist.h>
|
||||
|
||||
#if (defined(Q_OS_WIN) && !defined(Q_OS_WINCE))
|
||||
#if defined(Q_OS_WIN)
|
||||
#include <QtCore/private/qfsfileengine_p.h>
|
||||
#include "../../../network-settings.h"
|
||||
#endif
|
||||
@ -163,9 +163,8 @@ private slots:
|
||||
|
||||
void operator_eq();
|
||||
|
||||
#ifndef Q_OS_WINCE
|
||||
void dotAndDotDot();
|
||||
#endif
|
||||
|
||||
void homePath();
|
||||
void tempPath();
|
||||
void rootPath();
|
||||
@ -316,7 +315,7 @@ void tst_QDir::setPath_data()
|
||||
QTest::addColumn<QString>("dir2");
|
||||
|
||||
QTest::newRow("data0") << QString(".") << QString("..");
|
||||
#if (defined(Q_OS_WIN) && !defined(Q_OS_WINCE))
|
||||
#if defined(Q_OS_WIN)
|
||||
QTest::newRow("data1") << QString("c:/") << QDir::currentPath();
|
||||
#endif
|
||||
}
|
||||
@ -543,7 +542,7 @@ void tst_QDir::exists_data()
|
||||
|
||||
QTest::newRow("simple dir") << (m_dataPath + "/resources") << true;
|
||||
QTest::newRow("simple dir with slash") << (m_dataPath + "/resources/") << true;
|
||||
#if (defined(Q_OS_WIN) && !defined(Q_OS_WINCE)) && !defined(Q_OS_WINRT)
|
||||
#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
|
||||
const QString uncRoot = QStringLiteral("//") + QtNetworkSettings::winServerName();
|
||||
QTest::newRow("unc 1") << uncRoot << true;
|
||||
QTest::newRow("unc 2") << uncRoot + QLatin1Char('/') << true;
|
||||
@ -555,7 +554,7 @@ void tst_QDir::exists_data()
|
||||
QTest::newRow("unc 8") << uncRoot + "/asharethatshouldnotexist" << false;
|
||||
QTest::newRow("unc 9") << "//ahostthatshouldnotexist" << false;
|
||||
#endif
|
||||
#if (defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT))
|
||||
#if (defined(Q_OS_WIN) && !defined(Q_OS_WINRT))
|
||||
QTest::newRow("This drive should exist") << "C:/" << true;
|
||||
// find a non-existing drive and check if it does not exist
|
||||
#ifdef QT_BUILD_INTERNAL
|
||||
@ -596,7 +595,7 @@ void tst_QDir::isRelativePath_data()
|
||||
QTest::addColumn<bool>("relative");
|
||||
|
||||
QTest::newRow("data0") << "../somedir" << true;
|
||||
#if (defined(Q_OS_WIN) && !defined(Q_OS_WINCE))
|
||||
#if defined(Q_OS_WIN)
|
||||
QTest::newRow("data1") << "C:/sOmedir" << false;
|
||||
#endif
|
||||
QTest::newRow("data2") << "somedir" << true;
|
||||
@ -802,12 +801,6 @@ void tst_QDir::entryList()
|
||||
QFile::remove(entrylistPath + "brokenlink.lnk");
|
||||
QFile::remove(entrylistPath + "brokenlink");
|
||||
|
||||
// WinCE does not have . and .. in the directory listing
|
||||
#if defined(Q_OS_WINCE)
|
||||
expected.removeAll(".");
|
||||
expected.removeAll("..");
|
||||
#endif
|
||||
|
||||
#ifndef Q_NO_SYMLINKS
|
||||
#if defined(Q_OS_WIN)
|
||||
// ### Sadly, this is a platform difference right now.
|
||||
@ -900,15 +893,10 @@ void tst_QDir::entryListSimple_data()
|
||||
QTest::addColumn<int>("countMin");
|
||||
|
||||
QTest::newRow("data2") << "do_not_expect_this_path_to_exist/" << 0;
|
||||
#if defined(Q_OS_WINCE)
|
||||
QTest::newRow("simple dir") << (m_dataPath + "/resources") << 0;
|
||||
QTest::newRow("simple dir with slash") << (m_dataPath + "/resources/") << 0;
|
||||
#else
|
||||
QTest::newRow("simple dir") << (m_dataPath + "/resources") << 2;
|
||||
QTest::newRow("simple dir with slash") << (m_dataPath + "/resources/") << 2;
|
||||
#endif
|
||||
|
||||
#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
|
||||
#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
|
||||
const QString uncRoot = QStringLiteral("//") + QtNetworkSettings::winServerName();
|
||||
QTest::newRow("unc 1") << uncRoot << 2;
|
||||
QTest::newRow("unc 2") << uncRoot + QLatin1Char('/') << 2;
|
||||
@ -1170,25 +1158,21 @@ tst_QDir::cleanPath_data()
|
||||
QTest::newRow("data2") << "/" << "/";
|
||||
QTest::newRow("data3") << QDir::cleanPath("../.") << "..";
|
||||
QTest::newRow("data4") << QDir::cleanPath("../..") << "../..";
|
||||
#if !defined(Q_OS_WINCE)
|
||||
#if defined(Q_OS_WIN)
|
||||
QTest::newRow("data5") << "d:\\a\\bc\\def\\.." << "d:/a/bc";
|
||||
QTest::newRow("data6") << "d:\\a\\bc\\def\\../../.." << "d:/";
|
||||
#else
|
||||
QTest::newRow("data5") << "d:\\a\\bc\\def\\.." << "d:\\a\\bc\\def\\..";
|
||||
QTest::newRow("data6") << "d:\\a\\bc\\def\\../../.." << "..";
|
||||
#endif
|
||||
#endif
|
||||
QTest::newRow("data7") << ".//file1.txt" << "file1.txt";
|
||||
QTest::newRow("data8") << "/foo/bar/..//file1.txt" << "/foo/file1.txt";
|
||||
QTest::newRow("data9") << "//" << "/";
|
||||
#if !defined(Q_OS_WINCE)
|
||||
#if defined Q_OS_WIN
|
||||
QTest::newRow("data10") << "c:\\" << "c:/";
|
||||
#else
|
||||
QTest::newRow("data10") << "/:/" << "/:";
|
||||
#endif
|
||||
#endif
|
||||
#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
|
||||
QTest::newRow("data11") << "//foo//bar" << "//foo/bar";
|
||||
#endif
|
||||
@ -1350,7 +1334,7 @@ void tst_QDir::absolutePath_data()
|
||||
QTest::addColumn<QString>("expectedPath");
|
||||
|
||||
QTest::newRow("0") << "/machine/share/dir1" << "/machine/share/dir1";
|
||||
#if (defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT))
|
||||
#if (defined(Q_OS_WIN) && !defined(Q_OS_WINRT))
|
||||
QTest::newRow("1") << "\\machine\\share\\dir1" << "/machine/share/dir1";
|
||||
QTest::newRow("2") << "//machine/share/dir1" << "//machine/share/dir1";
|
||||
QTest::newRow("3") << "\\\\machine\\share\\dir1" << "//machine/share/dir1";
|
||||
@ -1399,7 +1383,7 @@ void tst_QDir::relativeFilePath_data()
|
||||
QTest::newRow("same path 1") << "/tmp" << "/tmp" << ".";
|
||||
QTest::newRow("same path 2") << "//tmp" << "/tmp/" << ".";
|
||||
|
||||
#if (defined(Q_OS_WIN) && !defined(Q_OS_WINCE))
|
||||
#if defined(Q_OS_WIN)
|
||||
QTest::newRow("12") << "C:/foo/bar" << "ding" << "ding";
|
||||
QTest::newRow("13") << "C:/foo/bar" << "C:/ding/dong" << "../../ding/dong";
|
||||
QTest::newRow("14") << "C:/foo/bar" << "/ding/dong" << "../../ding/dong";
|
||||
@ -1575,7 +1559,6 @@ void tst_QDir::operator_eq()
|
||||
dir1.setPath("..");
|
||||
}
|
||||
|
||||
#ifndef Q_OS_WINCE
|
||||
// WinCE does not have . nor ..
|
||||
void tst_QDir::dotAndDotDot()
|
||||
{
|
||||
@ -1585,7 +1568,6 @@ void tst_QDir::dotAndDotDot()
|
||||
entryList = dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot);
|
||||
QCOMPARE(entryList, QStringList() << QString("dir") << QString("spaces"));
|
||||
}
|
||||
#endif
|
||||
|
||||
void tst_QDir::homePath()
|
||||
{
|
||||
@ -1829,16 +1811,9 @@ void tst_QDir::updateFileLists()
|
||||
|
||||
QDir dir(fs.absoluteFilePath(dirName));
|
||||
|
||||
#if defined(Q_OS_WINCE)
|
||||
//no . and .. on these OS.
|
||||
QCOMPARE(dir.count(), uint(4));
|
||||
QCOMPARE(dir.entryList().size(), 4);
|
||||
QCOMPARE(dir.entryInfoList().size(), 4);
|
||||
#else
|
||||
QCOMPARE(dir.count(), uint(6));
|
||||
QCOMPARE(dir.entryList().size(), 6);
|
||||
QCOMPARE(dir.entryInfoList().size(), 6);
|
||||
#endif
|
||||
|
||||
dir.setFilter(QDir::AllEntries | QDir::NoDotAndDotDot);
|
||||
|
||||
|
@ -7,6 +7,4 @@ RESOURCES += qdiriterator.qrc
|
||||
TESTDATA += entrylist
|
||||
contains(CONFIG, builtin_testdata): DEFINES += BUILTIN_TESTDATA
|
||||
|
||||
wince*mips*|wincewm50smart-msvc200*: DEFINES += WINCE_BROKEN_ITERATE=1
|
||||
|
||||
win32: CONFIG += insignificant_test # Crashes on Windows in release builds
|
||||
|
@ -41,7 +41,7 @@
|
||||
#define Q_NO_SYMLINKS
|
||||
#endif
|
||||
|
||||
#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
|
||||
#if defined(Q_OS_WIN)
|
||||
# include "../../../network-settings.h"
|
||||
#endif
|
||||
|
||||
@ -103,7 +103,7 @@ private slots:
|
||||
void longPath();
|
||||
void dirorder();
|
||||
void relativePaths();
|
||||
#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
|
||||
#if defined(Q_OS_WIN)
|
||||
void uncPaths_data();
|
||||
void uncPaths();
|
||||
#endif
|
||||
@ -196,7 +196,7 @@ void tst_QDirIterator::initTestCase()
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if !defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
|
||||
#if !defined(Q_OS_WIN)
|
||||
createDirectory("hiddenDirs_hiddenFiles");
|
||||
createFile("hiddenDirs_hiddenFiles/normalFile");
|
||||
createFile("hiddenDirs_hiddenFiles/.hiddenFile");
|
||||
@ -239,10 +239,8 @@ void tst_QDirIterator::iterateRelativeDirectory_data()
|
||||
<< QString("entrylist") << QDirIterator::IteratorFlags(0)
|
||||
<< QDir::Filters(QDir::NoFilter) << QStringList("*")
|
||||
<< QString(
|
||||
#if !defined(Q_OS_WINCE)
|
||||
"entrylist/.,"
|
||||
"entrylist/..,"
|
||||
#endif
|
||||
"entrylist/file,"
|
||||
#ifndef Q_NO_SYMLINKS
|
||||
"entrylist/linktofile.lnk,"
|
||||
@ -257,9 +255,7 @@ void tst_QDirIterator::iterateRelativeDirectory_data()
|
||||
<< QString("entrylist") << QDirIterator::IteratorFlags(0)
|
||||
<< QDir::Filters(QDir::AllEntries | QDir::NoDot) << QStringList("*")
|
||||
<< QString(
|
||||
#if !defined(Q_OS_WINCE)
|
||||
"entrylist/..,"
|
||||
#endif
|
||||
"entrylist/file,"
|
||||
#ifndef Q_NO_SYMLINKS
|
||||
"entrylist/linktofile.lnk,"
|
||||
@ -274,9 +270,7 @@ void tst_QDirIterator::iterateRelativeDirectory_data()
|
||||
<< QString("entrylist") << QDirIterator::IteratorFlags(0)
|
||||
<< QDir::Filters(QDir::AllEntries | QDir::NoDotDot) << QStringList("*")
|
||||
<< QString(
|
||||
#if !defined(Q_OS_WINCE)
|
||||
"entrylist/.,"
|
||||
#endif
|
||||
"entrylist/file,"
|
||||
#ifndef Q_NO_SYMLINKS
|
||||
"entrylist/linktofile.lnk,"
|
||||
@ -305,12 +299,10 @@ void tst_QDirIterator::iterateRelativeDirectory_data()
|
||||
<< QString("entrylist") << QDirIterator::IteratorFlags(QDirIterator::Subdirectories | QDirIterator::FollowSymlinks)
|
||||
<< QDir::Filters(QDir::NoFilter) << QStringList("*")
|
||||
<< QString(
|
||||
#if !defined(Q_OS_WINCE)
|
||||
"entrylist/.,"
|
||||
"entrylist/..,"
|
||||
"entrylist/directory/.,"
|
||||
"entrylist/directory/..,"
|
||||
#endif
|
||||
"entrylist/file,"
|
||||
#ifndef Q_NO_SYMLINKS
|
||||
"entrylist/linktofile.lnk,"
|
||||
@ -345,11 +337,7 @@ void tst_QDirIterator::iterateRelativeDirectory_data()
|
||||
QTest::newRow("empty, default")
|
||||
<< QString("empty") << QDirIterator::IteratorFlags(0)
|
||||
<< QDir::Filters(QDir::NoFilter) << QStringList("*")
|
||||
#if defined(Q_OS_WINCE)
|
||||
<< QStringList();
|
||||
#else
|
||||
<< QString("empty/.,empty/..").split(',');
|
||||
#endif
|
||||
|
||||
QTest::newRow("empty, QDir::NoDotAndDotDot")
|
||||
<< QString("empty") << QDirIterator::IteratorFlags(0)
|
||||
@ -562,13 +550,6 @@ void tst_QDirIterator::longPath()
|
||||
while (dir.exists(dirName) || dir.mkdir(dirName)) {
|
||||
++n;
|
||||
dirName.append('x');
|
||||
#if defined(Q_OS_WINCE) && defined(WINCE_BROKEN_ITERATE)
|
||||
// Some Windows CE devices/emulators are broken.
|
||||
// though one can create directories of length <= 217,
|
||||
// FindNextFile only reports entries until ~ 214.
|
||||
if (n >= 210)
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
|
||||
QDirIterator it(dir.absolutePath(), QDir::NoDotAndDotDot|QDir::Dirs, QDirIterator::Subdirectories);
|
||||
@ -606,7 +587,7 @@ void tst_QDirIterator::relativePaths()
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
|
||||
#if defined(Q_OS_WIN)
|
||||
void tst_QDirIterator::uncPaths_data()
|
||||
{
|
||||
QTest::addColumn<QString>("dirName");
|
||||
|
@ -1,7 +1,2 @@
|
||||
TEMPLATE = subdirs
|
||||
wince* {
|
||||
SUBDIRS = test
|
||||
} else {
|
||||
SUBDIRS = test stdinprocess
|
||||
}
|
||||
|
||||
SUBDIRS = test stdinprocess
|
||||
|
@ -6,7 +6,6 @@ else: DEFINES += QT_NO_NETWORK
|
||||
|
||||
TARGET = ../tst_qfile
|
||||
SOURCES = ../tst_qfile.cpp
|
||||
wince: SOURCES += $$QT_SOURCE_TREE/src/corelib/kernel/qfunctions_wince.cpp
|
||||
|
||||
RESOURCES += ../qfile.qrc ../rename-fallback.qrc ../copy-fallback.qrc
|
||||
|
||||
|
@ -47,7 +47,7 @@ extern Q_CORE_EXPORT int qt_ntfs_permission_lookup;
|
||||
QT_END_NAMESPACE
|
||||
#endif
|
||||
|
||||
#if !defined(Q_OS_WINCE) && !defined(QT_NO_NETWORK)
|
||||
#if !defined(QT_NO_NETWORK)
|
||||
#include <QHostInfo>
|
||||
#endif
|
||||
#include <QProcess>
|
||||
@ -66,8 +66,6 @@ QT_END_NAMESPACE
|
||||
# include <sys/mount.h>
|
||||
#elif defined(Q_OS_IRIX)
|
||||
# include <sys/statfs.h>
|
||||
#elif defined(Q_OS_WINCE)
|
||||
# include <qplatformdefs.h>
|
||||
#elif defined(Q_OS_VXWORKS)
|
||||
# include <fcntl.h>
|
||||
#if defined(_WRS_KERNEL)
|
||||
@ -85,7 +83,7 @@ QT_END_NAMESPACE
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
|
||||
#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
|
||||
#if defined(Q_OS_WIN)
|
||||
#include "../../../network-settings.h"
|
||||
#endif
|
||||
|
||||
@ -135,11 +133,9 @@ private slots:
|
||||
void readAll_data();
|
||||
void readAll();
|
||||
void readAllBuffer();
|
||||
#if !defined(Q_OS_WINCE)
|
||||
void readAllStdin();
|
||||
void readLineStdin();
|
||||
void readLineStdin_lineByLine();
|
||||
#endif
|
||||
void text();
|
||||
void missingEndOfLine();
|
||||
void readBlock();
|
||||
@ -169,7 +165,7 @@ private slots:
|
||||
void writeTextFile_data();
|
||||
void writeTextFile();
|
||||
/* void largeFileSupport(); */
|
||||
#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
|
||||
#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
|
||||
void largeUncFileSupport();
|
||||
#endif
|
||||
void flush();
|
||||
@ -225,10 +221,8 @@ private slots:
|
||||
void mapWrittenFile_data();
|
||||
void mapWrittenFile();
|
||||
|
||||
#ifndef Q_OS_WINCE
|
||||
void openStandardStreamsFileDescriptors();
|
||||
void openStandardStreamsBufferedStreams();
|
||||
#endif
|
||||
|
||||
void resize_data();
|
||||
void resize();
|
||||
@ -491,7 +485,7 @@ void tst_QFile::exists()
|
||||
file.remove();
|
||||
QVERIFY(!file.exists());
|
||||
|
||||
#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
|
||||
#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
|
||||
const QString uncPath = "//" + QtNetworkSettings::winServerName() + "/testshare/readme.txt";
|
||||
QFile unc(uncPath);
|
||||
QVERIFY2(unc.exists(), msgFileDoesNotExist(uncPath).constData());
|
||||
@ -539,7 +533,7 @@ void tst_QFile::open_data()
|
||||
<< false << QFile::OpenError;
|
||||
QTest::newRow("noreadfile") << QString::fromLatin1(noReadFile) << int(QIODevice::ReadOnly)
|
||||
<< false << QFile::OpenError;
|
||||
#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
|
||||
#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
|
||||
//opening devices requires administrative privileges (and elevation).
|
||||
HANDLE hTest = CreateFile(_T("\\\\.\\PhysicalDrive0"), GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL);
|
||||
if (hTest != INVALID_HANDLE_VALUE) {
|
||||
@ -570,7 +564,7 @@ void tst_QFile::open()
|
||||
QSKIP("Running this test as root doesn't make sense");
|
||||
#endif
|
||||
|
||||
#if defined(Q_OS_WIN32) || defined(Q_OS_WINCE)
|
||||
#if defined(Q_OS_WIN32)
|
||||
QEXPECT_FAIL("noreadfile", "Windows does not currently support non-readable files.", Abort);
|
||||
#endif
|
||||
if (filename.isEmpty())
|
||||
@ -622,7 +616,7 @@ void tst_QFile::size_data()
|
||||
QTest::addColumn<qint64>("size");
|
||||
|
||||
QTest::newRow( "exist01" ) << m_testFile << (qint64)245;
|
||||
#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
|
||||
#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
|
||||
// Only test UNC on Windows./
|
||||
QTest::newRow("unc") << "//" + QString(QtNetworkSettings::winServerName() + "/testshare/test.pri") << (qint64)34;
|
||||
#endif
|
||||
@ -633,10 +627,6 @@ void tst_QFile::size()
|
||||
QFETCH( QString, filename );
|
||||
QFETCH( qint64, size );
|
||||
|
||||
#ifdef Q_OS_WINCE
|
||||
filename = QFileInfo(filename).absoluteFilePath();
|
||||
#endif
|
||||
|
||||
{
|
||||
QFile f( filename );
|
||||
QCOMPARE( f.size(), size );
|
||||
@ -656,9 +646,6 @@ void tst_QFile::size()
|
||||
fclose(stream);
|
||||
}
|
||||
|
||||
// Currently low level file I/O is not well supported on Windows CE, so
|
||||
// skip this part of the test.
|
||||
#ifndef Q_OS_WINCE
|
||||
{
|
||||
QFile f;
|
||||
|
||||
@ -671,7 +658,6 @@ void tst_QFile::size()
|
||||
f.close();
|
||||
QT_CLOSE(fd);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void tst_QFile::sizeNoExist()
|
||||
@ -916,7 +902,6 @@ private:
|
||||
};
|
||||
#endif // !QT_NO_PROCESS
|
||||
|
||||
#if !defined(Q_OS_WINCE)
|
||||
void tst_QFile::readAllStdin()
|
||||
{
|
||||
#ifdef QT_NO_PROCESS
|
||||
@ -1007,7 +992,6 @@ void tst_QFile::readLineStdin_lineByLine()
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
void tst_QFile::text()
|
||||
{
|
||||
@ -1108,7 +1092,7 @@ void tst_QFile::ungetChar()
|
||||
QCOMPARE(buf[2], '4');
|
||||
}
|
||||
|
||||
#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
|
||||
#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
|
||||
QString driveLetters()
|
||||
{
|
||||
wchar_t volumeName[MAX_PATH];
|
||||
@ -1145,7 +1129,7 @@ void tst_QFile::invalidFile_data()
|
||||
#if !defined(Q_OS_WIN)
|
||||
QTest::newRow( "x11" ) << QString( "qwe//" );
|
||||
#else
|
||||
#if !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
|
||||
#if !defined(Q_OS_WINRT)
|
||||
QTest::newRow( "colon2" ) << invalidDriveLetter() + QString::fromLatin1(":ail:invalid");
|
||||
#endif
|
||||
QTest::newRow( "colon3" ) << QString( ":failinvalid" );
|
||||
@ -1207,13 +1191,11 @@ void tst_QFile::permissions_data()
|
||||
QTest::newRow("data0") << QCoreApplication::instance()->applicationFilePath() << uint(QFile::ExeUser) << true << false;
|
||||
QTest::newRow("data1") << m_testSourceFile << uint(QFile::ReadUser) << true << false;
|
||||
QTest::newRow("readonly") << QString::fromLatin1("readonlyfile") << uint(QFile::WriteUser) << false << false;
|
||||
#ifndef Q_OS_WINCE
|
||||
QTest::newRow("longfile") << QString::fromLatin1("longFileNamelongFileNamelongFileNamelongFileName"
|
||||
"longFileNamelongFileNamelongFileNamelongFileName"
|
||||
"longFileNamelongFileNamelongFileNamelongFileName"
|
||||
"longFileNamelongFileNamelongFileNamelongFileName"
|
||||
"longFileNamelongFileNamelongFileNamelongFileName.txt") << uint(QFile::ReadUser) << true << true;
|
||||
#endif
|
||||
QTest::newRow("resource1") << ":/tst_qfileinfo/resources/file1.ext1" << uint(QFile::ReadUser) << true << false;
|
||||
QTest::newRow("resource2") << ":/tst_qfileinfo/resources/file1.ext1" << uint(QFile::WriteUser) << false << false;
|
||||
QTest::newRow("resource3") << ":/tst_qfileinfo/resources/file1.ext1" << uint(QFile::ExeUser) << false << false;
|
||||
@ -1365,15 +1347,9 @@ void tst_QFile::copyFallback()
|
||||
QVERIFY(QFile::exists("file-copy-destination.txt"));
|
||||
QVERIFY(!file.isOpen());
|
||||
|
||||
#ifdef Q_OS_WINCE
|
||||
// Need to reset permissions on Windows to be able to delete
|
||||
QVERIFY(QFile::setPermissions("file-copy-destination.txt",
|
||||
QFile::WriteOther));
|
||||
#else
|
||||
// Need to reset permissions on Windows to be able to delete
|
||||
QVERIFY(QFile::setPermissions("file-copy-destination.txt",
|
||||
QFile::ReadOwner | QFile::WriteOwner));
|
||||
#endif
|
||||
QVERIFY(QFile::remove("file-copy-destination.txt"));
|
||||
|
||||
// Fallback copy of open file.
|
||||
@ -1394,7 +1370,7 @@ void tst_QFile::copyFallback()
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
|
||||
#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
|
||||
static QString getWorkingDirectoryForLink(const QString &linkFileName)
|
||||
{
|
||||
bool neededCoInit = false;
|
||||
@ -1453,7 +1429,7 @@ void tst_QFile::link()
|
||||
|
||||
QCOMPARE(QFile::symLinkTarget("myLink.lnk"), referenceTarget);
|
||||
|
||||
#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
|
||||
#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
|
||||
QString wd = getWorkingDirectoryForLink(info2.absoluteFilePath());
|
||||
QCOMPARE(QDir::fromNativeSeparators(wd), QDir::cleanPath(info1.absolutePath()));
|
||||
#endif
|
||||
@ -1591,7 +1567,7 @@ void tst_QFile::writeTextFile()
|
||||
QCOMPARE(file.readAll(), out);
|
||||
}
|
||||
|
||||
#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
|
||||
#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
|
||||
void tst_QFile::largeUncFileSupport()
|
||||
{
|
||||
qint64 size = Q_INT64_C(8589934592);
|
||||
@ -1670,11 +1646,7 @@ void tst_QFile::bufferedRead()
|
||||
file.write("abcdef");
|
||||
file.close();
|
||||
|
||||
#if defined(Q_OS_WINCE)
|
||||
FILE *stdFile = fopen((QCoreApplication::applicationDirPath() + "/stdfile.txt").toLatin1() , "r");
|
||||
#else
|
||||
FILE *stdFile = fopen("stdfile.txt", "r");
|
||||
#endif
|
||||
QVERIFY(stdFile);
|
||||
char c;
|
||||
QCOMPARE(int(fread(&c, 1, 1, stdFile)), 1);
|
||||
@ -1819,11 +1791,7 @@ void tst_QFile::FILEReadWrite()
|
||||
f.close();
|
||||
}
|
||||
|
||||
#ifdef Q_OS_WINCE
|
||||
FILE *fp = fopen(qPrintable(QCoreApplication::applicationDirPath() + "\\FILEReadWrite.txt"), "r+b");
|
||||
#else
|
||||
FILE *fp = fopen("FILEReadWrite.txt", "r+b");
|
||||
#endif
|
||||
QVERIFY(fp);
|
||||
QFile file;
|
||||
QVERIFY2(file.open(fp, QFile::ReadWrite), msgOpenFailed(file).constData());
|
||||
@ -2028,10 +1996,6 @@ void tst_QFile::longFileName()
|
||||
}
|
||||
{
|
||||
QFile file(fileName);
|
||||
#if defined(Q_OS_WINCE)
|
||||
QEXPECT_FAIL("244 chars", "Full pathname must be less than 260 chars", Abort);
|
||||
QEXPECT_FAIL("244 chars to absolutepath", "Full pathname must be less than 260 chars", Abort);
|
||||
#endif
|
||||
QVERIFY2(file.open(QFile::WriteOnly | QFile::Text), msgOpenFailed(file).constData());
|
||||
QTextStream ts(&file);
|
||||
ts << fileName << endl;
|
||||
@ -2299,7 +2263,7 @@ void tst_QFile::writeLargeDataBlock_data()
|
||||
QTest::newRow("localfile-Fd") << "./largeblockfile.txt" << (int)OpenFd;
|
||||
QTest::newRow("localfile-Stream") << "./largeblockfile.txt" << (int)OpenStream;
|
||||
|
||||
#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) && !defined(QT_NO_NETWORK)
|
||||
#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) && !defined(QT_NO_NETWORK)
|
||||
// Some semi-randomness to avoid collisions.
|
||||
QTest::newRow("unc file")
|
||||
<< QString("//" + QtNetworkSettings::winServerName() + "/TESTSHAREWRITABLE/largefile-%1-%2.txt")
|
||||
@ -2314,8 +2278,8 @@ static QByteArray getLargeDataBlock()
|
||||
|
||||
if (array.isNull())
|
||||
{
|
||||
#if defined(Q_OS_WINCE) || defined(Q_OS_VXWORKS)
|
||||
int resizeSize = 1024 * 1024; // WinCE does not have much space
|
||||
#if defined(Q_OS_VXWORKS)
|
||||
int resizeSize = 1024 * 1024; // VxWorks does not have much space
|
||||
#else
|
||||
int resizeSize = 64 * 1024 * 1024;
|
||||
#endif
|
||||
@ -2443,9 +2407,7 @@ void tst_QFile::virtualFile()
|
||||
|
||||
void tst_QFile::textFile()
|
||||
{
|
||||
#if defined(Q_OS_WINCE)
|
||||
FILE *fs = ::fopen((QCoreApplication::applicationDirPath() + "/writeabletextfile").toLatin1() , "wt");
|
||||
#elif defined(Q_OS_WIN)
|
||||
#if defined(Q_OS_WIN)
|
||||
FILE *fs = ::fopen("writeabletextfile", "wt");
|
||||
#else
|
||||
FILE *fs = ::fopen("writeabletextfile", "w");
|
||||
@ -2658,7 +2620,7 @@ void tst_QFile::appendAndRead()
|
||||
|
||||
void tst_QFile::miscWithUncPathAsCurrentDir()
|
||||
{
|
||||
#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
|
||||
#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
|
||||
QString current = QDir::currentPath();
|
||||
const QString path = QLatin1String("//") + QtNetworkSettings::winServerName()
|
||||
+ QLatin1String("/testshare");
|
||||
@ -2682,7 +2644,6 @@ void tst_QFile::standarderror()
|
||||
void tst_QFile::handle()
|
||||
{
|
||||
int fd;
|
||||
#if !defined(Q_OS_WINCE)
|
||||
QFile file(m_testSourceFile);
|
||||
QVERIFY2(file.open(QIODevice::ReadOnly), msgOpenFailed(file).constData());
|
||||
fd = int(file.handle());
|
||||
@ -2710,7 +2671,6 @@ void tst_QFile::handle()
|
||||
#endif
|
||||
|
||||
QCOMPARE(c, '*');
|
||||
#endif
|
||||
|
||||
//test round trip of adopted stdio file handle
|
||||
QFile file2;
|
||||
@ -2953,10 +2913,6 @@ void tst_QFile::map()
|
||||
|
||||
QString fileName = QDir::currentPath() + '/' + "qfile_map_testfile";
|
||||
|
||||
#ifdef Q_OS_WINCE
|
||||
fileName = QFileInfo(fileName).absoluteFilePath();
|
||||
#endif
|
||||
|
||||
if (QFile::exists(fileName)) {
|
||||
QVERIFY(QFile::setPermissions(fileName,
|
||||
QFile::WriteOwner | QFile::ReadOwner | QFile::WriteUser | QFile::ReadUser));
|
||||
@ -2998,7 +2954,7 @@ void tst_QFile::map()
|
||||
QCOMPARE(file.error(), QFile::NoError);
|
||||
|
||||
// hpux won't let you map multiple times.
|
||||
#if !defined(Q_OS_HPUX) && !defined(Q_USE_DEPRECATED_MAP_API) && !defined(Q_OS_WINCE)
|
||||
#if !defined(Q_OS_HPUX) && !defined(Q_USE_DEPRECATED_MAP_API)
|
||||
// exotic test to make sure that multiple maps work
|
||||
|
||||
// note: windows ce does not reference count mutliple maps
|
||||
@ -3121,10 +3077,6 @@ void tst_QFile::mapOpenMode()
|
||||
QVERIFY2(file.open(om), msgOpenFailed(om, file).constData());
|
||||
|
||||
uchar *memory = file.map(0, fileSize, QFileDevice::MemoryMapFlags(flags));
|
||||
#if defined(Q_OS_WINCE)
|
||||
QEXPECT_FAIL("ReadOnly + MapPrivate" , "Windows CE does not support MapPrivateOption.", Abort);
|
||||
QEXPECT_FAIL("ReadWrite + MapPrivate", "Windows CE does not support MapPrivateOption.", Abort);
|
||||
#endif
|
||||
QVERIFY(memory);
|
||||
QVERIFY(memcmp(memory, pattern, fileSize) == 0);
|
||||
|
||||
@ -3157,10 +3109,6 @@ void tst_QFile::mapWrittenFile()
|
||||
|
||||
QString fileName = QDir::currentPath() + '/' + "qfile_map_testfile";
|
||||
|
||||
#ifdef Q_OS_WINCE
|
||||
fileName = QFileInfo(fileName).absoluteFilePath();
|
||||
#endif
|
||||
|
||||
if (QFile::exists(fileName)) {
|
||||
QVERIFY(QFile::setPermissions(fileName,
|
||||
QFile::WriteOwner | QFile::ReadOwner | QFile::WriteUser | QFile::ReadUser));
|
||||
@ -3259,10 +3207,6 @@ protected:
|
||||
bool MessageHandler::ok = true;
|
||||
QtMessageHandler MessageHandler::oldMessageHandler = 0;
|
||||
|
||||
//allthough Windows CE (not mobile!) has functions that allow redirecting
|
||||
//the standard file descriptors to a file (see SetStdioPathW/GetStdioPathW)
|
||||
//it does not have functions to simply open them like below .
|
||||
#ifndef Q_OS_WINCE
|
||||
void tst_QFile::openStandardStreamsFileDescriptors()
|
||||
{
|
||||
|
||||
@ -3322,7 +3266,6 @@ void tst_QFile::openStandardStreamsBufferedStreams()
|
||||
|
||||
QVERIFY(msgHandler.testPassed());
|
||||
}
|
||||
#endif
|
||||
|
||||
void tst_QFile::writeNothing()
|
||||
{
|
||||
|
@ -5,6 +5,6 @@ SOURCES = tst_qfileinfo.cpp
|
||||
RESOURCES += qfileinfo.qrc \
|
||||
testdata.qrc
|
||||
|
||||
win32:!wince:!winrt:LIBS += -ladvapi32 -lnetapi32
|
||||
win32:!winrt:LIBS += -ladvapi32 -lnetapi32
|
||||
|
||||
win32: CONFIG += insignificant_test # Crashes on Windows in release builds
|
||||
|
@ -49,13 +49,13 @@
|
||||
#ifdef Q_OS_WIN
|
||||
#include <qt_windows.h>
|
||||
#include <qlibrary.h>
|
||||
#if !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
|
||||
#if !defined(Q_OS_WINRT)
|
||||
#include <lm.h>
|
||||
#endif
|
||||
#endif
|
||||
#include <qplatformdefs.h>
|
||||
#include <qdebug.h>
|
||||
#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
|
||||
#if defined(Q_OS_WIN)
|
||||
#include "../../../network-settings.h"
|
||||
#endif
|
||||
#include <private/qfileinfo_p.h>
|
||||
@ -256,7 +256,7 @@ private slots:
|
||||
|
||||
void refresh();
|
||||
|
||||
#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
|
||||
#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
|
||||
void ntfsJunctionPointsAndSymlinks_data();
|
||||
void ntfsJunctionPointsAndSymlinks();
|
||||
void brokenShortcut();
|
||||
@ -273,7 +273,7 @@ private slots:
|
||||
|
||||
void detachingOperations();
|
||||
|
||||
#if !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
|
||||
#if !defined(Q_OS_WINRT)
|
||||
void owner();
|
||||
#endif
|
||||
void group();
|
||||
@ -354,17 +354,8 @@ void tst_QFileInfo::copy()
|
||||
file.flush();
|
||||
|
||||
QTest::qWait(250);
|
||||
#if defined(Q_OS_WIN) || defined(Q_OS_WINCE)
|
||||
if (QSysInfo::windowsVersion() & QSysInfo::WV_VISTA ||
|
||||
QSysInfo::windowsVersion() & QSysInfo::WV_CE_based)
|
||||
file.close();
|
||||
#endif
|
||||
#if defined(Q_OS_WINCE)
|
||||
// On Windows CE we need to close the file.
|
||||
// Otherwise the content will be cached and not
|
||||
// flushed to the storage, although we flushed it
|
||||
// manually!!! CE has interim cache, we cannot influence.
|
||||
QTest::qWait(5000);
|
||||
#if defined(Q_OS_WIN)
|
||||
file.close();
|
||||
#endif
|
||||
info3.refresh();
|
||||
privateInfo3 = getPrivate(info3);
|
||||
@ -422,12 +413,12 @@ void tst_QFileInfo::isDir_data()
|
||||
|
||||
QTest::newRow("broken link") << "brokenlink.lnk" << false;
|
||||
|
||||
#if (defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT))
|
||||
#if (defined(Q_OS_WIN) && !defined(Q_OS_WINRT))
|
||||
QTest::newRow("drive 1") << "c:" << true;
|
||||
QTest::newRow("drive 2") << "c:/" << true;
|
||||
//QTest::newRow("drive 2") << "t:s" << false;
|
||||
#endif
|
||||
#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
|
||||
#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
|
||||
const QString uncRoot = QStringLiteral("//") + QtNetworkSettings::winServerName();
|
||||
QTest::newRow("unc 1") << uncRoot << true;
|
||||
QTest::newRow("unc 2") << uncRoot + QLatin1Char('/') << true;
|
||||
@ -464,13 +455,13 @@ void tst_QFileInfo::isRoot_data()
|
||||
|
||||
QTest::newRow("simple dir") << m_resourcesDir << false;
|
||||
QTest::newRow("simple dir with slash") << (m_resourcesDir + QLatin1Char('/')) << false;
|
||||
#if (defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT))
|
||||
#if (defined(Q_OS_WIN) && !defined(Q_OS_WINRT))
|
||||
QTest::newRow("drive 1") << "c:" << false;
|
||||
QTest::newRow("drive 2") << "c:/" << true;
|
||||
QTest::newRow("drive 3") << "p:/" << false;
|
||||
#endif
|
||||
|
||||
#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
|
||||
#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
|
||||
const QString uncRoot = QStringLiteral("//") + QtNetworkSettings::winServerName();
|
||||
QTest::newRow("unc 1") << uncRoot << true;
|
||||
QTest::newRow("unc 2") << uncRoot + QLatin1Char('/') << true;
|
||||
@ -519,7 +510,7 @@ void tst_QFileInfo::exists_data()
|
||||
QTest::newRow("simple dir") << m_resourcesDir << true;
|
||||
QTest::newRow("simple dir with slash") << (m_resourcesDir + QLatin1Char('/')) << true;
|
||||
|
||||
#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
|
||||
#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
|
||||
const QString uncRoot = QStringLiteral("//") + QtNetworkSettings::winServerName();
|
||||
QTest::newRow("unc 1") << uncRoot << true;
|
||||
QTest::newRow("unc 2") << uncRoot + QLatin1Char('/') << true;
|
||||
@ -554,7 +545,7 @@ void tst_QFileInfo::absolutePath_data()
|
||||
QTest::addColumn<QString>("filename");
|
||||
|
||||
QString drivePrefix;
|
||||
#if (defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT))
|
||||
#if (defined(Q_OS_WIN) && !defined(Q_OS_WINRT))
|
||||
drivePrefix = QDir::currentPath().left(2);
|
||||
QString nonCurrentDrivePrefix =
|
||||
drivePrefix.left(1).compare("X", Qt::CaseInsensitive) == 0 ? QString("Y:") : QString("X:");
|
||||
@ -573,7 +564,7 @@ void tst_QFileInfo::absolutePath_data()
|
||||
QTest::newRow("3") << "/usr/local/bin/" << drivePrefix + "/usr/local/bin" << "";
|
||||
QTest::newRow("/test") << "/test" << drivePrefix + "/" << "test";
|
||||
|
||||
#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
|
||||
#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
|
||||
QTest::newRow("c:\\autoexec.bat") << "c:\\autoexec.bat" << "C:/"
|
||||
<< "autoexec.bat";
|
||||
QTest::newRow("c:autoexec.bat") << QDir::currentPath().left(2) + "autoexec.bat" << QDir::currentPath()
|
||||
@ -606,7 +597,7 @@ void tst_QFileInfo::absFilePath_data()
|
||||
QTest::newRow("relativeFile") << "tmp.txt" << QDir::currentPath() + "/tmp.txt";
|
||||
QTest::newRow("relativeFileInSubDir") << "temp/tmp.txt" << QDir::currentPath() + "/" + "temp/tmp.txt";
|
||||
QString drivePrefix;
|
||||
#if (defined(Q_OS_WIN) && !defined(Q_OS_WINCE))
|
||||
#if defined(Q_OS_WIN)
|
||||
QString curr = QDir::currentPath();
|
||||
|
||||
curr.remove(0, 2); // Make it a absolute path with no drive specifier: \depot\qt-4.2\tests\auto\qfileinfo
|
||||
@ -774,7 +765,7 @@ void tst_QFileInfo::fileName_data()
|
||||
|
||||
QTest::newRow("relativeFile") << "tmp.txt" << "tmp.txt";
|
||||
QTest::newRow("relativeFileInSubDir") << "temp/tmp.txt" << "tmp.txt";
|
||||
#if (defined(Q_OS_WIN) && !defined(Q_OS_WINCE))
|
||||
#if defined(Q_OS_WIN)
|
||||
QTest::newRow("absFilePath") << "c:\\home\\andy\\tmp.txt" << "tmp.txt";
|
||||
QTest::newRow("driveWithNoSlash") << "c:tmp.txt" << "tmp.txt";
|
||||
#else
|
||||
@ -1024,7 +1015,7 @@ void tst_QFileInfo::size()
|
||||
|
||||
void tst_QFileInfo::systemFiles()
|
||||
{
|
||||
#if !defined(Q_OS_WIN) || defined(Q_OS_WINCE) || defined(Q_OS_WINRT)
|
||||
#if !defined(Q_OS_WIN) || defined(Q_OS_WINRT)
|
||||
QSKIP("This is a Windows only test");
|
||||
#endif
|
||||
QFileInfo fi("c:\\pagefile.sys");
|
||||
@ -1121,11 +1112,7 @@ void tst_QFileInfo::fileTimes_data()
|
||||
|
||||
void tst_QFileInfo::fileTimes()
|
||||
{
|
||||
#if defined(Q_OS_WINCE)
|
||||
int sleepTime = 3000;
|
||||
#else
|
||||
int sleepTime = 2000;
|
||||
#endif
|
||||
QFETCH(QString, fileName);
|
||||
if (QFile::exists(fileName)) {
|
||||
QVERIFY(QFile::remove(fileName));
|
||||
@ -1133,10 +1120,6 @@ void tst_QFileInfo::fileTimes()
|
||||
QTest::qSleep(sleepTime);
|
||||
{
|
||||
QFile file(fileName);
|
||||
#if defined(Q_OS_WINCE)
|
||||
QEXPECT_FAIL("longfile", "No long filenames on WinCE", Abort);
|
||||
QEXPECT_FAIL("longfile absolutepath", "No long filenames on WinCE", Abort);
|
||||
#endif
|
||||
QVERIFY(file.open(QFile::WriteOnly | QFile::Text));
|
||||
#if defined(Q_OS_UNIX) && !defined(Q_OS_VXWORKS)
|
||||
if (qIsLikelyToBeNfs(file.handle()))
|
||||
@ -1162,7 +1145,7 @@ void tst_QFileInfo::fileTimes()
|
||||
{
|
||||
QFileInfo fileInfo(fileName);
|
||||
// On unix created() returns the same as lastModified().
|
||||
#if !defined(Q_OS_UNIX) && !defined(Q_OS_WINCE)
|
||||
#if !defined(Q_OS_UNIX)
|
||||
QVERIFY(fileInfo.created() < beforeWrite);
|
||||
#endif
|
||||
QVERIFY(fileInfo.lastModified() > beforeWrite);
|
||||
@ -1174,7 +1157,7 @@ void tst_QFileInfo::fileTimes()
|
||||
}
|
||||
|
||||
QFileInfo fileInfo(fileName);
|
||||
#if !defined(Q_OS_UNIX) && !defined(Q_OS_WINCE)
|
||||
#if !defined(Q_OS_UNIX)
|
||||
QVERIFY(fileInfo.created() < beforeWrite);
|
||||
#endif
|
||||
//In Vista the last-access timestamp is not updated when the file is accessed/touched (by default).
|
||||
@ -1193,9 +1176,7 @@ void tst_QFileInfo::fileTimes()
|
||||
RegCloseKey(key);
|
||||
}
|
||||
#endif
|
||||
#if defined(Q_OS_WINCE)
|
||||
QEXPECT_FAIL("simple", "WinCE only stores date of access data, not the time", Continue);
|
||||
#elif defined(Q_OS_WINRT)
|
||||
#if defined(Q_OS_WINRT)
|
||||
QEXPECT_FAIL("", "WinRT does not allow timestamp handling change in the filesystem due to sandboxing", Continue);
|
||||
#elif defined(Q_OS_QNX)
|
||||
QEXPECT_FAIL("", "QNX uses the noatime filesystem option", Continue);
|
||||
@ -1211,8 +1192,8 @@ void tst_QFileInfo::fileTimes()
|
||||
|
||||
void tst_QFileInfo::fileTimes_oldFile()
|
||||
{
|
||||
// This is not supported on WinCE or WinRT
|
||||
#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
|
||||
// This is not supported on WinRT
|
||||
#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
|
||||
// All files are opened in share mode (both read and write).
|
||||
DWORD shareMode = FILE_SHARE_READ | FILE_SHARE_WRITE;
|
||||
|
||||
@ -1310,7 +1291,7 @@ void tst_QFileInfo::isHidden_data()
|
||||
QTest::newRow(qPrintable("drive." + info.path())) << info.path() << false;
|
||||
}
|
||||
|
||||
#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
|
||||
#if defined(Q_OS_WIN)
|
||||
QVERIFY(QDir("./hidden-directory").exists() || QDir().mkdir("./hidden-directory"));
|
||||
QVERIFY(SetFileAttributesW(reinterpret_cast<LPCWSTR>(QString("./hidden-directory").utf16()),FILE_ATTRIBUTE_HIDDEN));
|
||||
QTest::newRow("C:/path/to/hidden-directory") << QDir::currentPath() + QString::fromLatin1("/hidden-directory") << true;
|
||||
@ -1413,7 +1394,7 @@ void tst_QFileInfo::isNativePath()
|
||||
|
||||
void tst_QFileInfo::refresh()
|
||||
{
|
||||
#if defined(Q_OS_WINCE) || defined(Q_OS_WIN)
|
||||
#if defined(Q_OS_WIN)
|
||||
int sleepTime = 3000;
|
||||
#else
|
||||
int sleepTime = 2000;
|
||||
@ -1436,17 +1417,8 @@ void tst_QFileInfo::refresh()
|
||||
QCOMPARE(info.lastModified(), lastModified);
|
||||
|
||||
QCOMPARE(info.size(), qint64(7));
|
||||
#if defined(Q_OS_WIN) || defined(Q_OS_WINCE)
|
||||
if (QSysInfo::windowsVersion() & QSysInfo::WV_VISTA ||
|
||||
QSysInfo::windowsVersion() & QSysInfo::WV_CE_based)
|
||||
file.close();
|
||||
#endif
|
||||
#if defined(Q_OS_WINCE)
|
||||
// On Windows CE we need to close the file.
|
||||
// Otherwise the content will be cached and not
|
||||
// flushed to the storage, although we flushed it
|
||||
// manually!!! CE has interim cache, we cannot influence.
|
||||
QTest::qWait(5000);
|
||||
#if defined(Q_OS_WIN)
|
||||
file.close();
|
||||
#endif
|
||||
info.refresh();
|
||||
QCOMPARE(info.size(), qint64(13));
|
||||
@ -1459,7 +1431,7 @@ void tst_QFileInfo::refresh()
|
||||
QCOMPARE(info2.size(), info.size());
|
||||
}
|
||||
|
||||
#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
|
||||
#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
|
||||
void tst_QFileInfo::ntfsJunctionPointsAndSymlinks_data()
|
||||
{
|
||||
QTest::addColumn<QString>("path");
|
||||
@ -1633,11 +1605,7 @@ void tst_QFileInfo::isWritable()
|
||||
tempfile.remove();
|
||||
|
||||
#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
|
||||
#ifdef Q_OS_WINCE
|
||||
QFileInfo fi("\\Windows\\wince.nls");
|
||||
#else
|
||||
QFileInfo fi("c:\\pagefile.sys");
|
||||
#endif
|
||||
QVERIFY2(fi.exists(), msgDoesNotExist(fi.absoluteFilePath()).constData());
|
||||
QVERIFY(!fi.isWritable());
|
||||
#endif
|
||||
@ -1813,8 +1781,7 @@ void tst_QFileInfo::detachingOperations()
|
||||
QVERIFY(!info1.caching());
|
||||
}
|
||||
|
||||
#if !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
|
||||
#if defined (Q_OS_WIN)
|
||||
#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
|
||||
BOOL IsUserAdmin()
|
||||
{
|
||||
BOOL b;
|
||||
@ -1835,14 +1802,14 @@ BOOL IsUserAdmin()
|
||||
|
||||
return(b);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(Q_OS_WIN)
|
||||
QT_BEGIN_NAMESPACE
|
||||
extern Q_CORE_EXPORT int qt_ntfs_permission_lookup;
|
||||
QT_END_NAMESPACE
|
||||
#endif
|
||||
|
||||
#endif // Q_OS_WIN && !Q_OS_WINRT
|
||||
|
||||
#ifndef Q_OS_WINRT
|
||||
void tst_QFileInfo::owner()
|
||||
{
|
||||
QString userName;
|
||||
@ -1904,7 +1871,7 @@ void tst_QFileInfo::owner()
|
||||
qt_ntfs_permission_lookup = 0;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
#endif // !Q_OS_WINRT
|
||||
|
||||
void tst_QFileInfo::group()
|
||||
{
|
||||
|
@ -146,12 +146,7 @@ void tst_QFileSystemWatcher::basicTest()
|
||||
// resolution of the modification time is system dependent, but it's at most 1 second when using
|
||||
// the polling engine. I've heard rumors that FAT32 has a 2 second resolution. So, we have to
|
||||
// wait a bit before we can modify the file (hrmph)...
|
||||
#ifndef Q_OS_WINCE
|
||||
QTest::qWait(2000);
|
||||
#else
|
||||
// WinCE is always a little bit slower. Give it a little bit more time
|
||||
QTest::qWait(5000);
|
||||
#endif
|
||||
|
||||
testFile.open(QIODevice::WriteOnly | QIODevice::Append);
|
||||
testFile.write(QByteArray("world"));
|
||||
@ -309,9 +304,6 @@ void tst_QFileSystemWatcher::watchDirectory()
|
||||
QVERIFY(temporaryDir.rmdir(testDirName));
|
||||
|
||||
// waiting max 5 seconds for notification for directory removal to trigger
|
||||
#ifdef Q_OS_WINCE
|
||||
QEXPECT_FAIL("poller", "Directory does not get updated on file removal(See #137910)", Abort);
|
||||
#endif
|
||||
QTRY_COMPARE(changedSpy.count(), 2);
|
||||
QCOMPARE(changedSpy.at(0).count(), 1);
|
||||
QCOMPARE(changedSpy.at(1).count(), 1);
|
||||
@ -553,9 +545,6 @@ void tst_QFileSystemWatcher::watchFileAndItsDirectory()
|
||||
QEXPECT_FAIL("", "See QTBUG-30943", Continue);
|
||||
#endif
|
||||
QCOMPARE(fileChangedSpyCount, 0);
|
||||
#ifdef Q_OS_WINCE
|
||||
QEXPECT_FAIL("poller", "Directory does not get updated on file removal(See #137910)", Abort);
|
||||
#endif
|
||||
QCOMPARE(dirChangedSpy.count(), 1);
|
||||
|
||||
dirChangedSpy.clear();
|
||||
|
@ -100,9 +100,6 @@ void tst_QIODevice::getSetCheck()
|
||||
//----------------------------------------------------------------------------------
|
||||
void tst_QIODevice::constructing_QTcpSocket()
|
||||
{
|
||||
#if defined(Q_OS_WINCE) && defined(WINCE_EMULATOR_TEST)
|
||||
QSKIP("Networking tests in a WinCE emulator are unstable");
|
||||
#endif
|
||||
if (!QtNetworkSettings::verifyTestNetworkSettings())
|
||||
QSKIP("No network test server available");
|
||||
|
||||
@ -205,9 +202,6 @@ void tst_QIODevice::read_QByteArray()
|
||||
//--------------------------------------------------------------------
|
||||
void tst_QIODevice::unget()
|
||||
{
|
||||
#if defined(Q_OS_WINCE) && defined(WINCE_EMULATOR_TEST)
|
||||
QSKIP("Networking tests in a WinCE emulator are unstable");
|
||||
#endif
|
||||
#if defined(Q_OS_MAC)
|
||||
QSKIP("The unget network test is unstable on Mac. See QTBUG-39983.");
|
||||
#endif
|
||||
|
@ -34,7 +34,7 @@
|
||||
#include <qsysinfo.h>
|
||||
#if defined(Q_OS_UNIX) && !defined(Q_OS_VXWORKS)
|
||||
#include <unistd.h>
|
||||
#elif defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
|
||||
#elif defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
|
||||
# include <qt_windows.h>
|
||||
#endif
|
||||
|
||||
@ -281,7 +281,7 @@ void tst_QLockFile::staleLockFromCrashedProcessReusedPid()
|
||||
{
|
||||
#if defined(QT_NO_PROCESS)
|
||||
QSKIP("This test requires QProcess support");
|
||||
#elif defined(Q_OS_WINRT) || defined(Q_OS_WINCE) || defined(Q_OS_IOS)
|
||||
#elif defined(Q_OS_WINRT) || defined(Q_OS_IOS)
|
||||
QSKIP("We cannot retrieve information about other processes on this platform.");
|
||||
#else
|
||||
const QString fileName = dir.path() + "/staleLockFromCrashedProcessReusedPid";
|
||||
@ -455,7 +455,7 @@ Q_DECLARE_OPERATORS_FOR_FLAGS(ProcessProperties)
|
||||
static inline ProcessProperties processProperties()
|
||||
{
|
||||
ProcessProperties result;
|
||||
#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
|
||||
#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
|
||||
HANDLE processToken = NULL;
|
||||
if (OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &processToken)) {
|
||||
DWORD elevation; // struct containing a DWORD, not present in some MinGW headers.
|
||||
@ -484,7 +484,7 @@ void tst_QLockFile::noPermissionsWindows()
|
||||
{
|
||||
// Windows: Do the permissions test in a system directory in which
|
||||
// files cannot be created.
|
||||
#if !defined(Q_OS_WIN) || defined(Q_OS_WINCE) || defined(Q_OS_WINRT)
|
||||
#if !defined(Q_OS_WIN) || defined(Q_OS_WINRT)
|
||||
QSKIP("This test is for desktop Windows only");
|
||||
#endif
|
||||
#ifdef Q_OS_WIN
|
||||
|
@ -4,4 +4,4 @@ TARGET = tst_qlockfile
|
||||
SOURCES += tst_qlockfile.cpp
|
||||
|
||||
QT = core testlib concurrent
|
||||
win32:!wince:!winrt:LIBS += -ladvapi32
|
||||
win32:!winrt:LIBS += -ladvapi32
|
||||
|
@ -10,13 +10,12 @@ SUBPROGRAMS = \
|
||||
testProcessDeadWhileReading \
|
||||
testProcessEOF \
|
||||
testExitCodes \
|
||||
testForwarding \
|
||||
testGuiProcess \
|
||||
testDetached \
|
||||
fileWriterProcess \
|
||||
testSetWorkingDirectory \
|
||||
testSoftExit
|
||||
|
||||
!contains(QMAKE_PLATFORM, wince): SUBPROGRAMS += testForwarding
|
||||
|
||||
!qtHaveModule(widgets): SUBPROGRAMS -= \
|
||||
testGuiProcess
|
||||
|
@ -8,7 +8,7 @@ SUBDIRS += testProcessSpacesArgs/nospace.pro \
|
||||
testProcessSpacesArgs/twospaces.pro \
|
||||
testSpaceInName
|
||||
|
||||
win32:!wince* {
|
||||
win32 {
|
||||
SUBDIRS += \
|
||||
testProcessEchoGui \
|
||||
testSetNamedPipeHandleState
|
||||
|
@ -31,21 +31,10 @@
|
||||
|
||||
int main(int argc, char ** argv)
|
||||
{
|
||||
#if defined(WINCE) || defined(_WIN32_WCE)
|
||||
// No pipes on this "OS"
|
||||
FILE* file = fopen("\\temp\\qprocess_args_test.txt","w+");
|
||||
for (int i = 0; i < argc; ++i) {
|
||||
if (i)
|
||||
fprintf(file, "|");
|
||||
fprintf(file, argv[i]);
|
||||
}
|
||||
fclose(file);
|
||||
#else
|
||||
for (int i = 0; i < argc; ++i) {
|
||||
if (i)
|
||||
printf("|");
|
||||
printf("%s", argv[i]);
|
||||
}
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
win32 {
|
||||
SOURCES = main_win.cpp
|
||||
!wince: LIBS += -luser32
|
||||
LIBS += -luser32
|
||||
}
|
||||
unix {
|
||||
SOURCES = main_unix.cpp
|
||||
|
@ -66,7 +66,6 @@ private slots:
|
||||
void startDetached();
|
||||
void crashTest();
|
||||
void crashTest2();
|
||||
#ifndef Q_OS_WINCE
|
||||
void echoTest_data();
|
||||
void echoTest();
|
||||
void echoTest2();
|
||||
@ -112,7 +111,6 @@ private slots:
|
||||
void discardUnwantedOutput();
|
||||
void setWorkingDirectory();
|
||||
void setNonExistentWorkingDirectory();
|
||||
#endif // not Q_OS_WINCE
|
||||
|
||||
void exitStatus_data();
|
||||
void exitStatus();
|
||||
@ -156,11 +154,9 @@ protected slots:
|
||||
void readFromProcess();
|
||||
void exitLoopSlot();
|
||||
void processApplicationEvents();
|
||||
#ifndef Q_OS_WINCE
|
||||
void restartProcess();
|
||||
void waitForReadyReadInAReadyReadSlotSlot();
|
||||
void waitForBytesWrittenInABytesWrittenSlotSlot();
|
||||
#endif
|
||||
|
||||
private:
|
||||
qint64 bytesAvailable;
|
||||
@ -411,8 +407,6 @@ void tst_QProcess::crashTest2()
|
||||
QCOMPARE(process.exitStatus(), QProcess::CrashExit);
|
||||
}
|
||||
|
||||
#ifndef Q_OS_WINCE
|
||||
//Reading and writing to a process is not supported on Qt/CE
|
||||
void tst_QProcess::echoTest_data()
|
||||
{
|
||||
QTest::addColumn<QByteArray>("input");
|
||||
@ -467,7 +461,6 @@ void tst_QProcess::echoTest()
|
||||
QCOMPARE(process.exitStatus(), QProcess::NormalExit);
|
||||
QCOMPARE(process.exitCode(), 0);
|
||||
}
|
||||
#endif
|
||||
|
||||
void tst_QProcess::exitLoopSlot()
|
||||
{
|
||||
@ -479,8 +472,6 @@ void tst_QProcess::processApplicationEvents()
|
||||
QCoreApplication::processEvents();
|
||||
}
|
||||
|
||||
#ifndef Q_OS_WINCE
|
||||
// Reading and writing to a process is not supported on Qt/CE
|
||||
void tst_QProcess::echoTest2()
|
||||
{
|
||||
|
||||
@ -528,10 +519,8 @@ void tst_QProcess::echoTest2()
|
||||
QCOMPARE(process.exitStatus(), QProcess::NormalExit);
|
||||
QCOMPARE(process.exitCode(), 0);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
|
||||
// Reading and writing to a process is not supported on Qt/CE
|
||||
#if defined(Q_OS_WIN)
|
||||
void tst_QProcess::echoTestGui()
|
||||
{
|
||||
QProcess process;
|
||||
@ -560,10 +549,9 @@ void tst_QProcess::testSetNamedPipeHandleState()
|
||||
QCOMPARE(process.exitCode(), 0);
|
||||
QCOMPARE(process.exitStatus(), QProcess::NormalExit);
|
||||
}
|
||||
#endif // !Q_OS_WINCE && Q_OS_WIN
|
||||
#endif // Q_OS_WIN
|
||||
|
||||
#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
|
||||
// Batch files are not supported on Windows CE
|
||||
#if defined(Q_OS_WIN)
|
||||
void tst_QProcess::batFiles_data()
|
||||
{
|
||||
QTest::addColumn<QString>("batFile");
|
||||
@ -590,7 +578,7 @@ void tst_QProcess::batFiles()
|
||||
|
||||
QVERIFY(proc.readAll().startsWith(output));
|
||||
}
|
||||
#endif // !Q_OS_WINCE && Q_OS_WIN
|
||||
#endif // Q_OS_WIN
|
||||
|
||||
void tst_QProcess::exitStatus_data()
|
||||
{
|
||||
@ -632,8 +620,6 @@ void tst_QProcess::exitStatus()
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef Q_OS_WINCE
|
||||
// Reading and writing to a process is not supported on Qt/CE
|
||||
void tst_QProcess::loopBackTest()
|
||||
{
|
||||
|
||||
@ -654,10 +640,7 @@ void tst_QProcess::loopBackTest()
|
||||
QCOMPARE(process.exitStatus(), QProcess::NormalExit);
|
||||
QCOMPARE(process.exitCode(), 0);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef Q_OS_WINCE
|
||||
// Reading and writing to a process is not supported on Qt/CE
|
||||
void tst_QProcess::readTimeoutAndThenCrash()
|
||||
{
|
||||
|
||||
@ -688,7 +671,6 @@ void tst_QProcess::readTimeoutAndThenCrash()
|
||||
QCOMPARE(spy2.count(), 1);
|
||||
QCOMPARE(*static_cast<const QProcess::ProcessError *>(spy2.at(0).at(0).constData()), QProcess::Crashed);
|
||||
}
|
||||
#endif
|
||||
|
||||
void tst_QProcess::waitForFinished()
|
||||
{
|
||||
@ -699,9 +681,6 @@ void tst_QProcess::waitForFinished()
|
||||
QVERIFY(process.waitForFinished());
|
||||
QCOMPARE(process.exitStatus(), QProcess::NormalExit);
|
||||
|
||||
#if defined (Q_OS_WINCE)
|
||||
QEXPECT_FAIL("", "Reading and writing to a process is not supported on Qt/CE", Continue);
|
||||
#endif
|
||||
QString output = process.readAll();
|
||||
QCOMPARE(output.count("\n"), 10*1024);
|
||||
|
||||
@ -713,8 +692,6 @@ void tst_QProcess::waitForFinished()
|
||||
QCOMPARE(process.error(), QProcess::FailedToStart);
|
||||
}
|
||||
|
||||
#ifndef Q_OS_WINCE
|
||||
// Reading and writing to a process is not supported on Qt/CE
|
||||
void tst_QProcess::deadWhileReading()
|
||||
{
|
||||
QProcess process;
|
||||
@ -732,10 +709,7 @@ void tst_QProcess::deadWhileReading()
|
||||
QCOMPARE(process.exitStatus(), QProcess::NormalExit);
|
||||
QCOMPARE(process.exitCode(), 0);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef Q_OS_WINCE
|
||||
// Reading and writing to a process is not supported on Qt/CE
|
||||
void tst_QProcess::restartProcessDeadlock()
|
||||
{
|
||||
|
||||
@ -765,10 +739,7 @@ void tst_QProcess::restartProcess()
|
||||
QVERIFY(process);
|
||||
process->start("testProcessEcho/testProcessEcho");
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef Q_OS_WINCE
|
||||
// Reading and writing to a process is not supported on Qt/CE
|
||||
void tst_QProcess::closeWriteChannel()
|
||||
{
|
||||
QProcess more;
|
||||
@ -794,10 +765,7 @@ void tst_QProcess::closeWriteChannel()
|
||||
QCOMPARE(more.exitStatus(), QProcess::NormalExit);
|
||||
QCOMPARE(more.exitCode(), 0);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef Q_OS_WINCE
|
||||
// Reading and writing to a process is not supported on Qt/CE"
|
||||
void tst_QProcess::closeReadChannel()
|
||||
{
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
@ -827,10 +795,7 @@ void tst_QProcess::closeReadChannel()
|
||||
QCOMPARE(proc.exitCode(), 0);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef Q_OS_WINCE
|
||||
// Reading and writing to a process is not supported on Qt/CE
|
||||
void tst_QProcess::openModes()
|
||||
{
|
||||
QProcess proc;
|
||||
@ -871,10 +836,7 @@ void tst_QProcess::openModes()
|
||||
QVERIFY(!proc.isWritable());
|
||||
QCOMPARE(proc.state(), QProcess::NotRunning);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef Q_OS_WINCE
|
||||
// Reading and writing to a process is not supported on Qt/CE
|
||||
void tst_QProcess::emitReadyReadOnlyWhenNewDataArrives()
|
||||
{
|
||||
|
||||
@ -908,17 +870,12 @@ void tst_QProcess::emitReadyReadOnlyWhenNewDataArrives()
|
||||
QCOMPARE(proc.exitStatus(), QProcess::NormalExit);
|
||||
QCOMPARE(proc.exitCode(), 0);
|
||||
}
|
||||
#endif
|
||||
|
||||
void tst_QProcess::hardExit()
|
||||
{
|
||||
QProcess proc;
|
||||
|
||||
#if defined(Q_OS_WINCE)
|
||||
proc.start("testSoftExit/testSoftExit");
|
||||
#else
|
||||
proc.start("testProcessEcho/testProcessEcho");
|
||||
#endif
|
||||
|
||||
QVERIFY2(proc.waitForStarted(), qPrintable(proc.errorString()));
|
||||
proc.kill();
|
||||
@ -935,9 +892,7 @@ void tst_QProcess::softExit()
|
||||
proc.start("testSoftExit/testSoftExit");
|
||||
|
||||
QVERIFY(proc.waitForStarted(10000));
|
||||
#if !defined(Q_OS_WINCE)
|
||||
QVERIFY(proc.waitForReadyRead(10000));
|
||||
#endif
|
||||
|
||||
QVERIFY(proc.processId() > 0);
|
||||
|
||||
@ -948,8 +903,6 @@ void tst_QProcess::softExit()
|
||||
QCOMPARE(int(proc.error()), int(QProcess::UnknownError));
|
||||
}
|
||||
|
||||
#ifndef Q_OS_WINCE
|
||||
// Reading and writing to a process is not supported on Qt/CE
|
||||
class SoftExitProcess : public QProcess
|
||||
{
|
||||
Q_OBJECT
|
||||
@ -1071,10 +1024,7 @@ void tst_QProcess::softExitInSlots()
|
||||
QTRY_VERIFY_WITH_TIMEOUT(proc.waitedForFinished, 10000);
|
||||
QCOMPARE(proc.state(), QProcess::NotRunning);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef Q_OS_WINCE
|
||||
// Reading and writing to a process is not supported on Qt/CE
|
||||
void tst_QProcess::mergedChannels()
|
||||
{
|
||||
QProcess process;
|
||||
@ -1097,10 +1047,6 @@ void tst_QProcess::mergedChannels()
|
||||
QCOMPARE(process.exitStatus(), QProcess::NormalExit);
|
||||
QCOMPARE(process.exitCode(), 0);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef Q_OS_WINCE
|
||||
// Reading and writing to a process is not supported on Qt/CE
|
||||
|
||||
void tst_QProcess::forwardedChannels_data()
|
||||
{
|
||||
@ -1153,10 +1099,7 @@ void tst_QProcess::forwardedChannels()
|
||||
QCOMPARE(process.readAllStandardOutput(), outdata);
|
||||
QCOMPARE(process.readAllStandardError(), errdata);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef Q_OS_WINCE
|
||||
// Reading and writing to a process is not supported on Qt/CE
|
||||
void tst_QProcess::atEnd()
|
||||
{
|
||||
QProcess process;
|
||||
@ -1178,7 +1121,6 @@ void tst_QProcess::atEnd()
|
||||
QCOMPARE(process.exitStatus(), QProcess::NormalExit);
|
||||
QCOMPARE(process.exitCode(), 0);
|
||||
}
|
||||
#endif
|
||||
|
||||
class TestThread : public QThread
|
||||
{
|
||||
@ -1200,9 +1142,7 @@ protected:
|
||||
|
||||
process.start("testProcessEcho/testProcessEcho");
|
||||
|
||||
#if !defined(Q_OS_WINCE)
|
||||
QCOMPARE(process.write("abc\0", 4), qint64(4));
|
||||
#endif
|
||||
exitCode = exec();
|
||||
}
|
||||
|
||||
@ -1251,8 +1191,6 @@ void tst_QProcess::processesInMultipleThreads()
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef Q_OS_WINCE
|
||||
// Reading and writing to a process is not supported on Qt/CE
|
||||
void tst_QProcess::waitForFinishedWithTimeout()
|
||||
{
|
||||
QProcess process;
|
||||
@ -1266,10 +1204,7 @@ void tst_QProcess::waitForFinishedWithTimeout()
|
||||
|
||||
QVERIFY(process.waitForFinished());
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef Q_OS_WINCE
|
||||
// Reading and writing to a process is not supported on Qt/CE
|
||||
void tst_QProcess::waitForReadyReadInAReadyReadSlot()
|
||||
{
|
||||
QProcess process;
|
||||
@ -1295,10 +1230,7 @@ void tst_QProcess::waitForReadyReadInAReadyReadSlot()
|
||||
QCOMPARE(process.exitCode(), 0);
|
||||
QVERIFY(process.bytesAvailable() > bytesAvailable);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef Q_OS_WINCE
|
||||
// Reading and writing to a process is not supported on Qt/CE
|
||||
void tst_QProcess::waitForReadyReadInAReadyReadSlotSlot()
|
||||
{
|
||||
QProcess *process = qobject_cast<QProcess *>(sender());
|
||||
@ -1308,10 +1240,7 @@ void tst_QProcess::waitForReadyReadInAReadyReadSlotSlot()
|
||||
QVERIFY(process->waitForReadyRead(5000));
|
||||
QTestEventLoop::instance().exitLoop();
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef Q_OS_WINCE
|
||||
// Reading and writing to a process is not supported on Qt/CE
|
||||
void tst_QProcess::waitForBytesWrittenInABytesWrittenSlot()
|
||||
{
|
||||
QProcess process;
|
||||
@ -1334,10 +1263,7 @@ void tst_QProcess::waitForBytesWrittenInABytesWrittenSlot()
|
||||
QCOMPARE(process.exitStatus(), QProcess::NormalExit);
|
||||
QCOMPARE(process.exitCode(), 0);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef Q_OS_WINCE
|
||||
// Reading and writing to a process is not supported on Qt/CE
|
||||
void tst_QProcess::waitForBytesWrittenInABytesWrittenSlotSlot()
|
||||
{
|
||||
QProcess *process = qobject_cast<QProcess *>(sender());
|
||||
@ -1346,7 +1272,6 @@ void tst_QProcess::waitForBytesWrittenInABytesWrittenSlotSlot()
|
||||
QVERIFY(process->waitForBytesWritten(5000));
|
||||
QTestEventLoop::instance().exitLoop();
|
||||
}
|
||||
#endif
|
||||
|
||||
void tst_QProcess::spaceArgsTest_data()
|
||||
{
|
||||
@ -1425,14 +1350,12 @@ void tst_QProcess::spaceArgsTest()
|
||||
QCOMPARE(process.exitStatus(), QProcess::NormalExit);
|
||||
QCOMPARE(process.exitCode(), 0);
|
||||
|
||||
#if !defined(Q_OS_WINCE)
|
||||
QStringList actual = QString::fromLatin1(process.readAll()).split("|");
|
||||
QVERIFY(!actual.isEmpty());
|
||||
// not interested in the program name, it might be different.
|
||||
actual.removeFirst();
|
||||
|
||||
QCOMPARE(actual, args);
|
||||
#endif
|
||||
|
||||
if (program.contains(QLatin1Char(' ')))
|
||||
program = QLatin1Char('"') + program + QLatin1Char('"');
|
||||
@ -1449,14 +1372,12 @@ void tst_QProcess::spaceArgsTest()
|
||||
QVERIFY2(started, errorMessage.constData());
|
||||
QVERIFY(process.waitForFinished(5000));
|
||||
|
||||
#if !defined(Q_OS_WINCE)
|
||||
actual = QString::fromLatin1(process.readAll()).split("|");
|
||||
QVERIFY(!actual.isEmpty());
|
||||
// not interested in the program name, it might be different.
|
||||
actual.removeFirst();
|
||||
|
||||
QCOMPARE(actual, args);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@ -1477,26 +1398,12 @@ void tst_QProcess::nativeArguments()
|
||||
QCOMPARE(proc.exitStatus(), QProcess::NormalExit);
|
||||
QCOMPARE(proc.exitCode(), 0);
|
||||
|
||||
#if defined(Q_OS_WINCE)
|
||||
// WinCE test outputs to a file, so check that
|
||||
FILE* file = fopen("\\temp\\qprocess_args_test.txt","r");
|
||||
QVERIFY(file);
|
||||
char buf[256];
|
||||
fgets(buf, 256, file);
|
||||
fclose(file);
|
||||
QStringList actual = QString::fromLatin1(buf).split(QLatin1Char('|'));
|
||||
#else
|
||||
QStringList actual = QString::fromLatin1(proc.readAll()).split(QLatin1Char('|'));
|
||||
#endif
|
||||
QVERIFY(!actual.isEmpty());
|
||||
// not interested in the program name, it might be different.
|
||||
actual.removeFirst();
|
||||
QStringList expected;
|
||||
#if defined(Q_OS_WINCE)
|
||||
expected << "hello" << "kitty," << "\"*\"!"; // Weird, weird ...
|
||||
#else
|
||||
expected << "hello" << "kitty," << "*!";
|
||||
#endif
|
||||
QCOMPARE(actual, expected);
|
||||
}
|
||||
|
||||
@ -1715,8 +1622,6 @@ void tst_QProcess::failToStartEmptyArgs()
|
||||
QCOMPARE(process.error(), QProcess::FailedToStart);
|
||||
}
|
||||
|
||||
#ifndef Q_OS_WINCE
|
||||
// Reading and writing to a process is not supported on Qt/CE
|
||||
void tst_QProcess::removeFileWhileProcessIsRunning()
|
||||
{
|
||||
QFile file(m_temporaryDir.path() + QLatin1String("/removeFile.txt"));
|
||||
@ -1734,9 +1639,7 @@ void tst_QProcess::removeFileWhileProcessIsRunning()
|
||||
QCOMPARE(process.exitStatus(), QProcess::NormalExit);
|
||||
QCOMPARE(process.exitCode(), 0);
|
||||
}
|
||||
#endif
|
||||
#ifndef Q_OS_WINCE
|
||||
// OS doesn't support environment variables
|
||||
|
||||
void tst_QProcess::setEnvironment_data()
|
||||
{
|
||||
QTest::addColumn<QString>("name");
|
||||
@ -1811,9 +1714,7 @@ void tst_QProcess::setEnvironment()
|
||||
QCOMPARE(process.readAll(), value.toLocal8Bit());
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#ifndef Q_OS_WINCE
|
||||
// OS doesn't support environment variables
|
||||
|
||||
void tst_QProcess::setProcessEnvironment_data()
|
||||
{
|
||||
setEnvironment_data();
|
||||
@ -1851,25 +1752,16 @@ void tst_QProcess::setProcessEnvironment()
|
||||
QCOMPARE(process.readAll(), value.toLocal8Bit());
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void tst_QProcess::systemEnvironment()
|
||||
{
|
||||
#if defined (Q_OS_WINCE)
|
||||
// there is no concept of system variables on Windows CE as there is no console
|
||||
QVERIFY(QProcess::systemEnvironment().isEmpty());
|
||||
QVERIFY(QProcessEnvironment::systemEnvironment().isEmpty());
|
||||
#else
|
||||
QVERIFY(!QProcess::systemEnvironment().isEmpty());
|
||||
QVERIFY(!QProcessEnvironment::systemEnvironment().isEmpty());
|
||||
|
||||
QVERIFY(QProcessEnvironment::systemEnvironment().contains("PATH"));
|
||||
QVERIFY(!QProcess::systemEnvironment().filter(QRegExp("^PATH=", Qt::CaseInsensitive)).isEmpty());
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifndef Q_OS_WINCE
|
||||
// Reading and writing to a process is not supported on Qt/CE
|
||||
void tst_QProcess::spaceInName()
|
||||
{
|
||||
QProcess process;
|
||||
@ -1880,7 +1772,6 @@ void tst_QProcess::spaceInName()
|
||||
QCOMPARE(process.exitStatus(), QProcess::NormalExit);
|
||||
QCOMPARE(process.exitCode(), 0);
|
||||
}
|
||||
#endif
|
||||
|
||||
void tst_QProcess::lockupsInStartDetached()
|
||||
{
|
||||
@ -1895,8 +1786,6 @@ void tst_QProcess::lockupsInStartDetached()
|
||||
QProcess::startDetached("yjhbrty");
|
||||
}
|
||||
|
||||
#ifndef Q_OS_WINCE
|
||||
// Reading and writing to a process is not supported on Qt/CE
|
||||
void tst_QProcess::atEnd2()
|
||||
{
|
||||
QProcess process;
|
||||
@ -1911,7 +1800,6 @@ void tst_QProcess::atEnd2()
|
||||
}
|
||||
QCOMPARE(lines.size(), 7);
|
||||
}
|
||||
#endif
|
||||
|
||||
void tst_QProcess::waitForReadyReadForNonexistantProcess()
|
||||
{
|
||||
@ -1944,8 +1832,6 @@ void tst_QProcess::waitForReadyReadForNonexistantProcess()
|
||||
QCOMPARE(finishedSpy2.count(), 0);
|
||||
}
|
||||
|
||||
#ifndef Q_OS_WINCE
|
||||
// Reading and writing to a process is not supported on Qt/CE
|
||||
void tst_QProcess::setStandardInputFile()
|
||||
{
|
||||
static const char data[] = "A bunch\1of\2data\3\4\5\6\7...";
|
||||
@ -1973,10 +1859,7 @@ void tst_QProcess::setStandardInputFile()
|
||||
all = process2.readAll();
|
||||
QCOMPARE(all.size(), 0);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef Q_OS_WINCE
|
||||
// Reading and writing to a process is not supported on Qt/CE
|
||||
void tst_QProcess::setStandardOutputFile_data()
|
||||
{
|
||||
QTest::addColumn<int>("channelToTest");
|
||||
@ -2094,10 +1977,7 @@ void tst_QProcess::setStandardOutputFileAndWaitForBytesWritten()
|
||||
|
||||
QCOMPARE(all, QByteArray::fromRawData(testdata, sizeof testdata - 1));
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef Q_OS_WINCE
|
||||
// Reading and writing to a process is not supported on Qt/CE
|
||||
void tst_QProcess::setStandardOutputProcess_data()
|
||||
{
|
||||
QTest::addColumn<bool>("merged");
|
||||
@ -2138,10 +2018,7 @@ void tst_QProcess::setStandardOutputProcess()
|
||||
else
|
||||
QCOMPARE(all, QByteArray("HHeelllloo,, WWoorrlldd"));
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef Q_OS_WINCE
|
||||
// Reading and writing to a process is not supported on Qt/CE
|
||||
void tst_QProcess::fileWriterProcess()
|
||||
{
|
||||
const QByteArray line = QByteArrayLiteral(" -- testing testing 1 2 3\n");
|
||||
@ -2175,16 +2052,11 @@ void tst_QProcess::fileWriterProcess()
|
||||
QCOMPARE(QFile(fileName).size(), qint64(stdinStr.size()));
|
||||
} while (stopWatch.elapsed() < 3000);
|
||||
}
|
||||
#endif
|
||||
|
||||
void tst_QProcess::detachedWorkingDirectoryAndPid()
|
||||
{
|
||||
qint64 pid;
|
||||
|
||||
#ifdef Q_OS_WINCE
|
||||
QTest::qSleep(1000);
|
||||
#endif
|
||||
|
||||
QFile infoFile(m_temporaryDir.path() + QLatin1String("/detachedinfo.txt"));
|
||||
if (infoFile.exists())
|
||||
QVERIFY(infoFile.remove());
|
||||
@ -2221,8 +2093,6 @@ void tst_QProcess::detachedWorkingDirectoryAndPid()
|
||||
QCOMPARE(actualPid, pid);
|
||||
}
|
||||
|
||||
#ifndef Q_OS_WINCE
|
||||
// Reading and writing to a process is not supported on Qt/CE
|
||||
void tst_QProcess::switchReadChannels()
|
||||
{
|
||||
const char data[] = "ABCD";
|
||||
@ -2251,10 +2121,7 @@ void tst_QProcess::switchReadChannels()
|
||||
process.setReadChannel(QProcess::StandardOutput);
|
||||
QCOMPARE(process.read(1), QByteArray("D"));
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef Q_OS_WINCE
|
||||
// Reading and writing to a process is not supported on Qt/CE
|
||||
void tst_QProcess::discardUnwantedOutput()
|
||||
{
|
||||
QProcess process;
|
||||
@ -2272,11 +2139,8 @@ void tst_QProcess::discardUnwantedOutput()
|
||||
process.setReadChannel(QProcess::StandardError);
|
||||
QCOMPARE(process.bytesAvailable(), Q_INT64_C(0));
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef Q_OS_WINCE
|
||||
// Q_OS_WIN - setWorkingDirectory will chdir before starting the process on unices
|
||||
// Windows CE does not support working directory logic
|
||||
void tst_QProcess::setWorkingDirectory()
|
||||
{
|
||||
QProcess process;
|
||||
@ -2315,7 +2179,6 @@ void tst_QProcess::setNonExistentWorkingDirectory()
|
||||
QVERIFY2(process.errorString().startsWith("chdir:"), process.errorString().toLocal8Bit());
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
void tst_QProcess::startFinishStartFinish()
|
||||
{
|
||||
@ -2325,11 +2188,9 @@ void tst_QProcess::startFinishStartFinish()
|
||||
QCOMPARE(process.state(), QProcess::NotRunning);
|
||||
|
||||
process.start("testProcessOutput/testProcessOutput");
|
||||
#if !defined(Q_OS_WINCE)
|
||||
QVERIFY(process.waitForReadyRead(10000));
|
||||
QCOMPARE(QString::fromLatin1(process.readLine().trimmed()),
|
||||
QString("0 -this is a number"));
|
||||
#endif
|
||||
if (process.state() != QProcess::NotRunning) {
|
||||
QVERIFY(process.waitForFinished(10000));
|
||||
QCOMPARE(process.exitStatus(), QProcess::NormalExit);
|
||||
|
@ -44,9 +44,7 @@ private slots:
|
||||
|
||||
void caseSensitivity();
|
||||
void systemEnvironment();
|
||||
#ifndef Q_OS_WINCE
|
||||
void putenv();
|
||||
#endif
|
||||
};
|
||||
|
||||
void tst_QProcessEnvironment::operator_eq()
|
||||
@ -257,12 +255,6 @@ void tst_QProcessEnvironment::systemEnvironment()
|
||||
|
||||
QVERIFY(nonexistant.isNull());
|
||||
|
||||
#ifdef Q_OS_WINCE
|
||||
// Windows CE has no environment
|
||||
QVERIFY(path.isEmpty());
|
||||
QVERIFY(!system.contains("PATH"));
|
||||
QVERIFY(system.isEmpty());
|
||||
#else
|
||||
// all other system have environments
|
||||
if (path.isEmpty())
|
||||
QFAIL("Could not find the PATH environment variable -- please correct the test environment");
|
||||
@ -272,18 +264,15 @@ void tst_QProcessEnvironment::systemEnvironment()
|
||||
|
||||
QVERIFY(!system.contains(envname));
|
||||
|
||||
# ifdef Q_OS_WIN
|
||||
#ifdef Q_OS_WIN
|
||||
// check case-insensitive too
|
||||
QVERIFY(system.contains("path"));
|
||||
QCOMPARE(system.value("path"), QString::fromLocal8Bit(path));
|
||||
|
||||
QVERIFY(!system.contains(QString(envname).toLower()));
|
||||
# endif
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifndef Q_OS_WINCE
|
||||
//Windows CE has no environment
|
||||
void tst_QProcessEnvironment::putenv()
|
||||
{
|
||||
static const char envname[] = "WE_RE_SETTING_THIS_ENVIRONMENT_VARIABLE";
|
||||
@ -317,7 +306,6 @@ void tst_QProcessEnvironment::putenv()
|
||||
QCOMPARE(eAfter.value(lower), QString("Hello, World"));
|
||||
# endif
|
||||
}
|
||||
#endif
|
||||
|
||||
QTEST_MAIN(tst_QProcessEnvironment)
|
||||
|
||||
|
@ -1521,7 +1521,7 @@ void tst_QSettings::sync()
|
||||
|
||||
// Now "some other app" will change other.software.org.ini
|
||||
QString userConfDir = settingsPath("__user__") + QDir::separator();
|
||||
#if !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
|
||||
#if !defined(Q_OS_WINRT)
|
||||
unlink((userConfDir + "other.software.org.ini").toLatin1());
|
||||
rename((userConfDir + "software.org.ini").toLatin1(),
|
||||
(userConfDir + "other.software.org.ini").toLatin1());
|
||||
|
@ -266,7 +266,7 @@ void tst_QTemporaryDir::nonWritableCurrentDir()
|
||||
|
||||
void tst_QTemporaryDir::openOnRootDrives()
|
||||
{
|
||||
#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
|
||||
#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
|
||||
unsigned int lastErrorMode = SetErrorMode(SEM_FAILCRITICALERRORS);
|
||||
#endif
|
||||
// If it's possible to create a file in the root directory, it
|
||||
@ -280,7 +280,7 @@ void tst_QTemporaryDir::openOnRootDrives()
|
||||
QVERIFY(dir.isValid());
|
||||
}
|
||||
}
|
||||
#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
|
||||
#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
|
||||
SetErrorMode(lastErrorMode);
|
||||
#endif
|
||||
}
|
||||
|
@ -374,9 +374,7 @@ void tst_QTemporaryFile::size()
|
||||
// On CE it takes more time for the filesystem to update
|
||||
// the information. Usually you have to close it or seek
|
||||
// to get latest information. flush() does not help either.
|
||||
#if !defined(Q_OS_WINCE)
|
||||
QCOMPARE(file.size(), qint64(6));
|
||||
#endif
|
||||
file.seek(0);
|
||||
QCOMPARE(file.size(), qint64(6));
|
||||
}
|
||||
@ -395,7 +393,7 @@ void tst_QTemporaryFile::resize()
|
||||
|
||||
void tst_QTemporaryFile::openOnRootDrives()
|
||||
{
|
||||
#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
|
||||
#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
|
||||
unsigned int lastErrorMode = SetErrorMode(SEM_FAILCRITICALERRORS);
|
||||
#endif
|
||||
// If it's possible to create a file in the root directory, it
|
||||
@ -409,19 +407,14 @@ void tst_QTemporaryFile::openOnRootDrives()
|
||||
QVERIFY(file.open());
|
||||
}
|
||||
}
|
||||
#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
|
||||
#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
|
||||
SetErrorMode(lastErrorMode);
|
||||
#endif
|
||||
}
|
||||
|
||||
void tst_QTemporaryFile::stressTest()
|
||||
{
|
||||
#if defined(Q_OS_WINCE)
|
||||
// 200 is still ok, first colision happens after ~30
|
||||
const int iterations = 200;
|
||||
#else
|
||||
const int iterations = 1000;
|
||||
#endif
|
||||
|
||||
QSet<QString> names;
|
||||
for (int i = 0; i < iterations; ++i) {
|
||||
|
@ -175,20 +175,16 @@ private slots:
|
||||
void octTest();
|
||||
void zeroTermination();
|
||||
void ws_manipulator();
|
||||
#ifndef Q_OS_WINCE
|
||||
void stillOpenWhenAtEnd();
|
||||
#endif
|
||||
void readNewlines_data();
|
||||
void readNewlines();
|
||||
void seek();
|
||||
void pos();
|
||||
void pos2();
|
||||
void pos3LargeFile();
|
||||
#if !defined(Q_OS_WINCE)
|
||||
void readStdin();
|
||||
void readAllFromStdin();
|
||||
void readLineFromStdin();
|
||||
#endif
|
||||
void read();
|
||||
void qbool();
|
||||
void forcePoint();
|
||||
@ -1207,8 +1203,6 @@ void tst_QTextStream::ws_manipulator()
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------
|
||||
#ifndef Q_OS_WINCE
|
||||
// Qt/CE: Cannot test network on emulator
|
||||
void tst_QTextStream::stillOpenWhenAtEnd()
|
||||
{
|
||||
QFile file(QFINDTESTDATA("tst_qtextstream.cpp"));
|
||||
@ -1229,7 +1223,6 @@ void tst_QTextStream::stillOpenWhenAtEnd()
|
||||
while (!stream2.readLine().isNull()) {}
|
||||
QVERIFY(socket.isOpen());
|
||||
}
|
||||
#endif
|
||||
|
||||
// ------------------------------------------------------------------------------
|
||||
void tst_QTextStream::readNewlines_data()
|
||||
@ -1498,8 +1491,6 @@ void tst_QTextStream::pos3LargeFile()
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------
|
||||
// Qt/CE has no stdin/out support for processes
|
||||
#if !defined(Q_OS_WINCE)
|
||||
void tst_QTextStream::readStdin()
|
||||
{
|
||||
#ifdef QT_NO_PROCESS
|
||||
@ -1527,7 +1518,6 @@ void tst_QTextStream::readStdin()
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------
|
||||
// Qt/CE has no stdin/out support for processes
|
||||
void tst_QTextStream::readAllFromStdin()
|
||||
{
|
||||
#ifdef QT_NO_PROCESS
|
||||
@ -1549,7 +1539,6 @@ void tst_QTextStream::readAllFromStdin()
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------
|
||||
// Qt/CE has no stdin/out support for processes
|
||||
void tst_QTextStream::readLineFromStdin()
|
||||
{
|
||||
#ifdef QT_NO_PROCESS
|
||||
@ -1572,7 +1561,6 @@ void tst_QTextStream::readLineFromStdin()
|
||||
QVERIFY(stdinProcess.waitForFinished(5000));
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
// ------------------------------------------------------------------------------
|
||||
void tst_QTextStream::read()
|
||||
@ -2799,12 +2787,7 @@ void tst_QTextStream::status_real_read()
|
||||
|
||||
void tst_QTextStream::status_integer_read()
|
||||
{
|
||||
#ifdef Q_OS_WINCE
|
||||
QString text = QLatin1String("123 abc ");
|
||||
QTextStream s(&text);
|
||||
#else
|
||||
QTextStream s("123 abc ");
|
||||
#endif
|
||||
int i;
|
||||
QString w;
|
||||
s >> i;
|
||||
@ -2822,12 +2805,7 @@ void tst_QTextStream::status_integer_read()
|
||||
|
||||
void tst_QTextStream::status_word_read()
|
||||
{
|
||||
#ifdef Q_OS_WINCE
|
||||
QString text = QLatin1String("abc ");
|
||||
QTextStream s(&text);
|
||||
#else
|
||||
QTextStream s("abc ");
|
||||
#endif
|
||||
QString w;
|
||||
s >> w;
|
||||
QCOMPARE(s.status(), QTextStream::Ok);
|
||||
|
@ -239,18 +239,10 @@ QModelIndex ModelsToTest::populateTestArea(QAbstractItemModel *model)
|
||||
// Basic tree StandardItemModel
|
||||
QModelIndex parent;
|
||||
QVariant blue = QVariant(QColor(Qt::blue));
|
||||
#ifndef Q_OS_WINCE
|
||||
for (int i = 0; i < 4; ++i) {
|
||||
#else
|
||||
for (int i = 0; i < 2; ++i) {
|
||||
#endif
|
||||
parent = model->index(0, 0, parent);
|
||||
model->insertRows(0, 26 + i, parent);
|
||||
#ifndef Q_OS_WINCE
|
||||
model->insertColumns(0, 26 + i, parent);
|
||||
#else
|
||||
model->insertColumns(0, 4 + i, parent);
|
||||
#endif
|
||||
// Fill in some values to make it easier to debug
|
||||
/*
|
||||
for (int x = 0; x < 26 + i; ++x) {
|
||||
@ -272,18 +264,10 @@ QModelIndex ModelsToTest::populateTestArea(QAbstractItemModel *model)
|
||||
// Basic tree StandardItemModel
|
||||
QModelIndex parent;
|
||||
QVariant blue = QVariant(QColor(Qt::blue));
|
||||
#ifndef Q_OS_WINCE
|
||||
for (int i = 0; i < 4; ++i) {
|
||||
#else
|
||||
for (int i = 0; i < 2; ++i) {
|
||||
#endif
|
||||
parent = realModel->index(0, 0, parent);
|
||||
realModel->insertRows(0, 26+i, parent);
|
||||
#ifndef Q_OS_WINCE
|
||||
realModel->insertColumns(0, 26+i, parent);
|
||||
#else
|
||||
realModel->insertColumns(0, 4, parent);
|
||||
#endif
|
||||
// Fill in some values to make it easier to debug
|
||||
/*
|
||||
for (int x = 0; x < 26+i; ++x) {
|
||||
@ -324,11 +308,7 @@ QModelIndex ModelsToTest::populateTestArea(QAbstractItemModel *model)
|
||||
QSqlQuery q;
|
||||
q.exec("CREATE TABLE test(id int primary key, name varchar(30))");
|
||||
q.prepare("INSERT INTO test(id, name) values (?, ?)");
|
||||
#ifndef Q_OS_WINCE
|
||||
for (int i = 0; i < 1024; ++i) {
|
||||
#else
|
||||
for (int i = 0; i < 512; ++i) {
|
||||
#endif
|
||||
q.addBindValue(i);
|
||||
q.addBindValue("Mr. Smith" + QString::number(i));
|
||||
q.exec();
|
||||
@ -344,11 +324,7 @@ QModelIndex ModelsToTest::populateTestArea(QAbstractItemModel *model)
|
||||
}
|
||||
|
||||
if (QListWidget *listWidget = qobject_cast<QListWidget *>(model->parent())) {
|
||||
#ifndef Q_OS_WINCE
|
||||
int items = 100;
|
||||
#else
|
||||
int items = 50;
|
||||
#endif
|
||||
while (items--)
|
||||
listWidget->addItem(QLatin1String("item ") + QString::number(items));
|
||||
return QModelIndex();
|
||||
|
@ -155,7 +155,7 @@ void tst_QCoreApplication::qAppName()
|
||||
|
||||
void tst_QCoreApplication::argc()
|
||||
{
|
||||
#if defined(Q_OS_WINCE) || defined(Q_OS_WINRT)
|
||||
#if defined(Q_OS_WINRT)
|
||||
QSKIP("QCoreApplication::arguments() parses arguments from actual command line on this platform.");
|
||||
#endif
|
||||
{
|
||||
|
@ -3,6 +3,6 @@ TARGET = tst_qeventloop
|
||||
QT = core network testlib core-private
|
||||
SOURCES = $$PWD/tst_qeventloop.cpp
|
||||
|
||||
win32:!wince:!winrt: LIBS += -luser32
|
||||
win32:!winrt: LIBS += -luser32
|
||||
|
||||
contains(QT_CONFIG, glib): DEFINES += HAVE_GLIB
|
||||
|
@ -6,11 +6,11 @@ SOURCES = tst_qmetatype.cpp
|
||||
TESTDATA=./typeFlags.bin
|
||||
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
|
||||
|
||||
win32-msvc*|wince|winrt {
|
||||
win32-msvc*|winrt {
|
||||
# Prevents "fatal error C1128: number of sections exceeded object file format limit".
|
||||
QMAKE_CXXFLAGS += /bigobj
|
||||
# Reduce compile time
|
||||
win32-msvc2012|wince|winrt {
|
||||
win32-msvc2012|winrt {
|
||||
QMAKE_CXXFLAGS_RELEASE -= -O2
|
||||
QMAKE_CFLAGS_RELEASE -= -O2
|
||||
}
|
||||
|
@ -2,9 +2,6 @@ CONFIG -= app_bundle debug_and_release
|
||||
CONFIG += console
|
||||
DESTDIR = ./
|
||||
QT = core
|
||||
wince {
|
||||
LIBS += coredll.lib
|
||||
}
|
||||
|
||||
HEADERS += signalbug.h
|
||||
SOURCES += signalbug.cpp
|
||||
|
@ -1572,11 +1572,7 @@ Q_DECLARE_METATYPE(PropertyObject::Priority)
|
||||
|
||||
void tst_QObject::threadSignalEmissionCrash()
|
||||
{
|
||||
#if defined(Q_OS_WINCE)
|
||||
int loopCount = 100;
|
||||
#else
|
||||
int loopCount = 1000;
|
||||
#endif
|
||||
for (int i = 0; i < loopCount; ++i) {
|
||||
QTcpSocket socket;
|
||||
socket.connectToHost("localhost", 80);
|
||||
|
@ -90,7 +90,7 @@ private slots:
|
||||
|
||||
// extreme cases
|
||||
void useTooMuchMemory();
|
||||
#if !defined(Q_OS_HPUX) && !defined(Q_OS_WINCE)
|
||||
#if !defined(Q_OS_HPUX)
|
||||
void attachTooMuch();
|
||||
#endif
|
||||
|
||||
@ -516,8 +516,7 @@ void tst_QSharedMemory::useTooMuchMemory()
|
||||
attach before the system runs out of resources.
|
||||
*/
|
||||
// HPUX doesn't allow for multiple attaches per process.
|
||||
// For WinCE, this test nearly kills the system, so skip it.
|
||||
#if !defined(Q_OS_HPUX) && !defined(Q_OS_WINCE)
|
||||
#if !defined(Q_OS_HPUX)
|
||||
void tst_QSharedMemory::attachTooMuch()
|
||||
{
|
||||
QSKIP("disabled");
|
||||
@ -576,9 +575,7 @@ void tst_QSharedMemory::simpleProducerConsumer()
|
||||
char *get = (char*)consumer.data();
|
||||
// On Windows CE you always have ReadWrite access. Thus
|
||||
// ViewMapOfFile returns the same pointer
|
||||
#if !defined(Q_OS_WINCE)
|
||||
QVERIFY(put != get);
|
||||
#endif
|
||||
for (int i = 0; i < size; ++i) {
|
||||
put[i] = 'Q';
|
||||
QCOMPARE(get[i], 'Q');
|
||||
|
@ -295,9 +295,6 @@ void tst_QTimer::livelock()
|
||||
QTRY_COMPARE(tester.timeoutsForFirst, 1);
|
||||
QCOMPARE(tester.timeoutsForExtra, 0);
|
||||
QTRY_COMPARE(tester.timeoutsForSecond, 1);
|
||||
#if defined(Q_OS_WINCE)
|
||||
QEXPECT_FAIL("non-zero timer", "Windows CE devices often too slow", Continue);
|
||||
#endif
|
||||
QVERIFY(tester.postEventAtRightTime);
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,6 @@ TARGET = mylib
|
||||
DESTDIR = ../
|
||||
QT = core
|
||||
|
||||
wince: DEFINES += WIN32_MSVC
|
||||
win32-msvc: DEFINES += WIN32_MSVC
|
||||
|
||||
# This project is testdata for tst_qlibrary
|
||||
|
@ -7,7 +7,6 @@ DESTDIR = ../
|
||||
VERSION = 2
|
||||
QT = core
|
||||
|
||||
wince: DEFINES += WIN32_MSVC
|
||||
win32-msvc: DEFINES += WIN32_MSVC
|
||||
|
||||
# Force a copy of the library to have an extension that is non-standard.
|
||||
|
@ -189,7 +189,7 @@ void tst_QLibrary::load_data()
|
||||
QTest::newRow("ok (libmylib ver. 1)") << appDir + "/libmylib" <<true;
|
||||
#endif
|
||||
|
||||
# if defined(Q_OS_WIN32) || defined(Q_OS_WINCE)
|
||||
# if defined(Q_OS_WIN32)
|
||||
QTest::newRow( "ok01 (with suffix)" ) << appDir + "/mylib.dll" << true;
|
||||
QTest::newRow( "ok02 (with non-standard suffix)" ) << appDir + "/mylib.dl2" << true;
|
||||
QTest::newRow( "ok03 (with many dots)" ) << appDir + "/system.qt.test.mylib.dll" << true;
|
||||
@ -346,11 +346,7 @@ void tst_QLibrary::errorString_data()
|
||||
|
||||
QTest::newRow("bad load()") << (int)Load << QString("nosuchlib") << false << QString("Cannot load library nosuchlib: .*");
|
||||
QTest::newRow("call errorString() on QLibrary with no d-pointer (crashtest)") << (int)(Load | DontSetFileName) << QString() << false << QString("Unknown error");
|
||||
#ifdef Q_OS_WINCE
|
||||
QTest::newRow("bad resolve") << (int)Resolve << appDir + "/mylib" << false << QString("Cannot resolve symbol \"nosuchsymbol\" in .*: .*");
|
||||
#else
|
||||
QTest::newRow("bad resolve") << (int)Resolve << appDir + "/mylib" << false << QString("Cannot resolve symbol \"nosuchsymbol\" in \\S+: .*");
|
||||
#endif
|
||||
QTest::newRow("good resolve") << (int)Resolve << appDir + "/mylib" << true << QString("Unknown error");
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
@ -414,7 +410,7 @@ void tst_QLibrary::loadHints_data()
|
||||
QString appDir = QCoreApplication::applicationDirPath();
|
||||
|
||||
lh |= QLibrary::ResolveAllSymbolsHint;
|
||||
# if defined(Q_OS_WIN32) || defined(Q_OS_WINCE) || defined(Q_OS_WINRT)
|
||||
# if defined(Q_OS_WIN32) || defined(Q_OS_WINRT)
|
||||
QTest::newRow( "ok01 (with suffix)" ) << appDir + "/mylib.dll" << int(lh) << true;
|
||||
QTest::newRow( "ok02 (with non-standard suffix)" ) << appDir + "/mylib.dl2" << int(lh) << true;
|
||||
QTest::newRow( "ok03 (with many dots)" ) << appDir + "/system.qt.test.mylib.dll" << int(lh) << true;
|
||||
@ -467,13 +463,8 @@ void tst_QLibrary::fileName_data()
|
||||
QTest::newRow( "ok02" ) << sys_qualifiedLibraryName(QLatin1String("mylib"))
|
||||
<< sys_qualifiedLibraryName(QLatin1String("mylib"));
|
||||
#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
|
||||
#ifndef Q_OS_WINCE
|
||||
QTest::newRow( "ok03" ) << "user32"
|
||||
<< "USER32.dll";
|
||||
#else
|
||||
QTest::newRow( "ok03" ) << "coredll"
|
||||
<< "coredll.dll";
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -140,11 +140,6 @@ void tst_QPluginLoader::cleanup()
|
||||
|
||||
void tst_QPluginLoader::errorString()
|
||||
{
|
||||
#if defined(Q_OS_WINCE)
|
||||
// On WinCE we need an QCoreApplication object for current dir
|
||||
int argc = 0;
|
||||
QCoreApplication app(argc,0);
|
||||
#endif
|
||||
const QString unknown(QLatin1String("Unknown error"));
|
||||
|
||||
{
|
||||
|
@ -350,15 +350,9 @@ const int AlphabetSize = sizeof(alphabet) - 1;
|
||||
const int BufferSize = 4096; // GCD of BufferSize and alphabet size must be 1
|
||||
char buffer[BufferSize];
|
||||
|
||||
#ifndef Q_OS_WINCE
|
||||
const int ProducerChunkSize = 3;
|
||||
const int ConsumerChunkSize = 7;
|
||||
const int Multiplier = 10;
|
||||
#else
|
||||
const int ProducerChunkSize = 2;
|
||||
const int ConsumerChunkSize = 5;
|
||||
const int Multiplier = 3;
|
||||
#endif
|
||||
|
||||
// note: the code depends on the fact that DataSize is a multiple of
|
||||
// ProducerChunkSize, ConsumerChunkSize, and BufferSize
|
||||
|
@ -95,9 +95,7 @@ private slots:
|
||||
|
||||
void requestTermination();
|
||||
|
||||
#ifndef Q_OS_WINCE
|
||||
void stressTest();
|
||||
#endif
|
||||
|
||||
void quitLock();
|
||||
};
|
||||
@ -664,7 +662,7 @@ void NativeThreadWrapper::start(FunctionPointer functionPointer, void *data)
|
||||
#if defined Q_OS_UNIX
|
||||
const int state = pthread_create(&nativeThreadHandle, 0, NativeThreadWrapper::runUnix, this);
|
||||
Q_UNUSED(state);
|
||||
#elif defined(Q_OS_WINCE) || defined(Q_OS_WINRT)
|
||||
#elif defined(Q_OS_WINRT)
|
||||
nativeThreadHandle = CreateThread(NULL, 0 , (LPTHREAD_START_ROUTINE)NativeThreadWrapper::runWin , this, 0, NULL);
|
||||
#elif defined Q_OS_WIN
|
||||
unsigned thrdid = 0;
|
||||
@ -684,11 +682,7 @@ void NativeThreadWrapper::join()
|
||||
#if defined Q_OS_UNIX
|
||||
pthread_join(nativeThreadHandle, 0);
|
||||
#elif defined Q_OS_WIN
|
||||
#ifndef Q_OS_WINCE
|
||||
WaitForSingleObjectEx(nativeThreadHandle, INFINITE, FALSE);
|
||||
#else
|
||||
WaitForSingleObject(nativeThreadHandle, INFINITE);
|
||||
#endif
|
||||
CloseHandle(nativeThreadHandle);
|
||||
#endif
|
||||
}
|
||||
@ -874,13 +868,8 @@ void tst_QThread::adoptedThreadExecFinished()
|
||||
void tst_QThread::adoptMultipleThreads()
|
||||
{
|
||||
#if defined(Q_OS_WIN)
|
||||
// Windows CE is not capable of handling that many threads. On the emulator it is dead with 26 threads already.
|
||||
# if defined(Q_OS_WINCE)
|
||||
const int numThreads = 20;
|
||||
# else
|
||||
// need to test lots of threads, so that we exceed MAXIMUM_WAIT_OBJECTS in qt_adopted_thread_watcher()
|
||||
const int numThreads = 200;
|
||||
# endif
|
||||
#else
|
||||
const int numThreads = 5;
|
||||
#endif
|
||||
@ -911,13 +900,8 @@ void tst_QThread::adoptMultipleThreads()
|
||||
void tst_QThread::adoptMultipleThreadsOverlap()
|
||||
{
|
||||
#if defined(Q_OS_WIN)
|
||||
// Windows CE is not capable of handling that many threads. On the emulator it is dead with 26 threads already.
|
||||
# if defined(Q_OS_WINCE)
|
||||
const int numThreads = 20;
|
||||
# else
|
||||
// need to test lots of threads, so that we exceed MAXIMUM_WAIT_OBJECTS in qt_adopted_thread_watcher()
|
||||
const int numThreads = 200;
|
||||
# endif
|
||||
#else
|
||||
const int numThreads = 5;
|
||||
#endif
|
||||
@ -950,7 +934,6 @@ void tst_QThread::adoptMultipleThreadsOverlap()
|
||||
QCOMPARE(recorder.activationCount.load(), numThreads);
|
||||
}
|
||||
|
||||
#ifndef Q_OS_WINCE
|
||||
// Disconnects on WinCE
|
||||
void tst_QThread::stressTest()
|
||||
{
|
||||
@ -962,7 +945,6 @@ void tst_QThread::stressTest()
|
||||
t.wait(one_minute);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
class Syncronizer : public QObject
|
||||
{ Q_OBJECT
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user