OSDN Git Service

mostly win leftovers removal
authorIvailo Monev <xakepa10@laimg.moc>
Thu, 15 Sep 2016 17:44:32 +0000 (17:44 +0000)
committerIvailo Monev <xakepa10@laimg.moc>
Thu, 15 Sep 2016 17:44:32 +0000 (17:44 +0000)
Signed-off-by: Ivailo Monev <xakepa10@laimg.moc>
src/core/QtCore.dynlist [deleted file]
src/core/codecs/qtextcodec.cpp
src/core/io/qtextstream.cpp
src/core/thread/qthread.cpp
src/core/thread/qthread.h
src/core/thread/qthread_p.h
src/core/thread/qthread_unix.cpp

diff --git a/src/core/QtCore.dynlist b/src/core/QtCore.dynlist
deleted file mode 100644 (file)
index 51e4c5a..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-{
-     extern "C" {
-         "qt_startup_hook";
-         "qt_addObject";
-         "qt_removeObject";
-     };
-     extern "C++" {
-         "QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>)";
-     };
-};
index da5e894..2429387 100644 (file)
 #include <langinfo.h>
 #endif
 
-#if defined(Q_OS_WINCE)
-#  define QT_NO_SETLOCALE
-#endif
-
-
-
 // enabling this is not exception safe!
 // #define Q_DEBUG_TEXTCODEC
 
@@ -518,11 +512,7 @@ static const char * const probably_koi8_rlocales[] = {
 static QTextCodec * ru_RU_hack(const char * i) {
     QTextCodec * ru_RU_codec = 0;
 
-#if !defined(QT_NO_SETLOCALE)
-    QByteArray origlocale(setlocale(LC_CTYPE, i));
-#else
-    QByteArray origlocale(i);
-#endif
+    const QByteArray origlocale(setlocale(LC_CTYPE, i));
     // unicode   koi8r   latin5   name
     // 0x044E    0xC0    0xEE     CYRILLIC SMALL LETTER YU
     // 0x042E    0xE0    0xCE     CYRILLIC CAPITAL LETTER YU
@@ -538,9 +528,7 @@ static QTextCodec * ru_RU_hack(const char * i) {
         qWarning("QTextCodec: Using KOI8-R, probe failed (%02x %02x %s)",
                   koi8r, latin5, i);
     }
-#if !defined(QT_NO_SETLOCALE)
     setlocale(LC_CTYPE, origlocale);
-#endif
 
     return ru_RU_codec;
 }
@@ -594,11 +582,7 @@ static void setupLocaleMapper()
         // First part is getting that locale name.  First try setlocale() which
         // definitely knows it, but since we cannot fully trust it, get ready
         // to fall back to environment variables.
-#if !defined(QT_NO_SETLOCALE)
         const QByteArray ctype = setlocale(LC_CTYPE, 0);
-#else
-        const QByteArray ctype;
-#endif
 
         // Get the first nonempty value from $LC_ALL, $LC_CTYPE, and $LANG
         // environment variables.
@@ -735,7 +719,6 @@ static void setup()
 #  endif // Q_WS_X11
 
 
-#if !defined(Q_OS_INTEGRITY)
 #  if defined(QT_NO_ICONV) && !defined(QT_BOOTSTRAPPED) && !defined(QT_CODEC_PLUGINS)
     // no asian codecs when bootstrapping, sorry
     (void)new QGb18030Codec;
@@ -749,13 +732,8 @@ static void setup()
     (void)new QBig5Codec;
     (void)new QBig5hkscsCodec;
 #  endif // QT_NO_ICONV && !QT_BOOTSTRAPPED && !QT_CODEC_PLUGINS
-#endif //Q_OS_INTEGRITY
 #endif // QT_NO_CODECS
 
-#if defined(Q_OS_WIN32) || defined(Q_OS_WINCE)
-    (void) new QWindowsLocalCodec;
-#endif // Q_OS_WIN32
-
     (void)new QUtf16Codec;
     (void)new QUtf16BECodec;
     (void)new QUtf16LECodec;
@@ -766,7 +744,7 @@ static void setup()
     (void)new QLatin1Codec;
     (void)new QUtf8Codec;
 
-#if !defined(Q_OS_INTEGRITY) && defined(Q_OS_UNIX) && !defined(QT_NO_ICONV) && !defined(QT_BOOTSTRAPPED)
+#if !defined(QT_NO_ICONV) && !defined(QT_BOOTSTRAPPED)
     // QIconvCodec depends on the UTF-16 codec, so it needs to be created last
     (void) new QIconvCodec();
 #endif
index 033b4cb..8c6a424 100644 (file)
@@ -231,9 +231,7 @@ static const int QTEXTSTREAM_BUFFERSIZE = 16384;
 #ifndef QT_NO_TEXTCODEC
 #include "qtextcodec.h"
 #endif
-#ifndef Q_OS_WINCE
 #include <locale.h>
-#endif
 #include "qlocale_p.h"
 
 #include <stdlib.h>
@@ -528,29 +526,10 @@ bool QTextStreamPrivate::fillReadBuffer(qint64 maxBytes)
     // read raw data into a temporary buffer
     char buf[QTEXTSTREAM_BUFFERSIZE];
     qint64 bytesRead = 0;
-#if defined(Q_OS_WIN)
-    // On Windows, there is no non-blocking stdin - so we fall back to reading
-    // lines instead. If there is no QOBJECT, we read lines for all sequential
-    // devices; otherwise, we read lines only for stdin.
-    QFile *file = 0;
-    Q_UNUSED(file);
-    if (device->isSequential()
-#if !defined(QT_NO_QOBJECT)
-        && (file = qobject_cast<QFile *>(device)) && file->handle() == 0
-#endif
-        ) {
-        if (maxBytes != -1)
-            bytesRead = device->readLine(buf, qMin<qint64>(sizeof(buf), maxBytes));
-        else
-            bytesRead = device->readLine(buf, sizeof(buf));
-    } else
-#endif
-    {
-        if (maxBytes != -1)
-            bytesRead = device->read(buf, qMin<qint64>(sizeof(buf), maxBytes));
-        else
-            bytesRead = device->read(buf, sizeof(buf));
-    }
+    if (maxBytes != -1)
+        bytesRead = device->read(buf, qMin<qint64>(sizeof(buf), maxBytes));
+    else
+        bytesRead = device->read(buf, sizeof(buf));
 
 #ifndef QT_NO_TEXTCODEC
     // codec auto detection, explicitly defaults to locale encoding if the
@@ -653,15 +632,6 @@ void QTextStreamPrivate::flushWriteBuffer()
     if (writeBuffer.isEmpty())
         return;
 
-#if defined (Q_OS_WIN)
-    // handle text translation and bypass the Text flag in the device.
-    bool textModeEnabled = device->isTextModeEnabled();
-    if (textModeEnabled) {
-        device->setTextModeEnabled(false);
-        writeBuffer.replace(QLatin1Char('\n'), QLatin1String("\r\n"));
-    }
-#endif
-
 #ifndef QT_NO_TEXTCODEC
     if (!codec)
         codec = QTextCodec::codecForLocale();
@@ -688,12 +658,6 @@ void QTextStreamPrivate::flushWriteBuffer()
         return;
     }
 
-#if defined (Q_OS_WIN)
-    // replace the text flag
-    if (textModeEnabled)
-        device->setTextModeEnabled(true);
-#endif
-
     // flush the file
 #ifndef QT_NO_QOBJECT
     QFile *file = qobject_cast<QFile *>(device);
index dcd4cc4..7266ca8 100644 (file)
 #include "qthread_p.h"
 #include "qcoreapplication_p.h"
 
-/*
-#ifdef Q_OS_WIN32
-# include "qt_windows.h"
-#else
-# include <unistd.h>
-# include <netinet/in.h>
-# include <sys/utsname.h>
-# include <sys/socket.h>
-*/
-/*
-#  elif defined(Q_OS_HPUX)
-#   include <sys/pstat.h>
-#  elif defined(Q_OS_FREEBSD) || defined(Q_OS_OPENBSD) || defined(Q_OS_MAC)
-#   include <sys/sysctl.h>
-#  endif
-#endif
-*/
-
 QT_BEGIN_NAMESPACE
 
 /*
@@ -175,18 +157,6 @@ QThreadPrivate::QThreadPrivate(QThreadData *d)
       isInFinish(false), exited(false), returnCode(-1),
       stackSize(0), priority(QThread::InheritPriority), data(d)
 {
-#if defined (Q_OS_UNIX)
-    thread_id = 0;
-#elif defined (Q_WS_WIN)
-    handle = 0;
-    id = 0;
-    waiters = 0;
-#endif
-#if defined (Q_WS_WIN)
-    terminationEnabled = true;
-    terminatePending = false;
-#endif
-
     if (!data)
         data = new QThreadData;
 }
index cd46879..59a0fdd 100644 (file)
@@ -57,8 +57,8 @@ class QThreadPrivate;
 class Q_CORE_EXPORT QThread : public QObject
 {
 public:
-    static Qt::HANDLE currentThreadId();
     static QThread *currentThread();
+    static Qt::HANDLE currentThreadId();
     static int idealThreadCount();
     static void yieldCurrentThread();
 
@@ -130,9 +130,10 @@ private:
 class Q_CORE_EXPORT QThread : public QObject
 {
 public:
-    static Qt::HANDLE currentThreadId() { return Qt::HANDLE(currentThread()); }
     static QThread* currentThread();
-    
+    static inline Qt::HANDLE currentThreadId()
+        { return Qt::HANDLE(currentThread()); }
+
 protected:
     QThread(QThreadPrivate &dd, QObject *parent = 0);
 
index 7c0fb08..1533258 100644 (file)
@@ -152,27 +152,12 @@ public:
 
     static QThread *threadForId(int id);
 
-#ifdef Q_OS_UNIX
     pthread_t thread_id;
     QWaitCondition thread_done;
 
     static void *start(void *arg);
     static void finish(void *);
 
-#endif // Q_OS_UNIX
-
-#if defined(Q_OS_WIN32) || defined(Q_OS_WINCE)
-    HANDLE handle;
-    unsigned int id;
-    int waiters;
-
-    static unsigned int __stdcall start(void *);
-    static void finish(void *, bool lockAnyway=true);
-#endif // Q_OS_WIN32
-
-#if defined(Q_OS_WIN32) || defined(Q_OS_WINCE)
-    bool terminationEnabled, terminatePending;
-# endif
     QThreadData *data;
 
     static void createEventDispatcher(QThreadData *data);
index b1bb355..57592b1 100644 (file)
@@ -263,19 +263,13 @@ void QThreadPrivate::createEventDispatcher(QThreadData *data)
 
 #ifndef QT_NO_THREAD
 
-#if (defined(Q_OS_LINUX) || (defined(Q_OS_MAC) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6) || defined(Q_OS_QNX))
+#if defined(Q_OS_LINUX)
 static void setCurrentThreadName(pthread_t threadId, const char *name)
 {
-#  if defined(Q_OS_LINUX) && !defined(QT_LINUXBASE)
+#if defined(Q_OS_LINUX) && !defined(QT_LINUXBASE)
     Q_UNUSED(threadId);
     prctl(PR_SET_NAME, (unsigned long)name, 0, 0, 0);
-#  elif (defined(Q_OS_MAC) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6)
-    Q_UNUSED(threadId);
-    if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_6)
-        pthread_setname_np(name);
-#  elif defined(Q_OS_QNX)
-    pthread_setname_np(threadId, name);
-#  endif
+#endif
 }
 #endif
 
@@ -304,7 +298,7 @@ void *QThreadPrivate::start(void *arg)
     // ### TODO: allow the user to create a custom event dispatcher
     createEventDispatcher(data);
 
-#if (defined(Q_OS_LINUX) || (defined(Q_OS_MAC) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6) || defined(Q_OS_QNX))
+#if defined(Q_OS_LINUX)
     // sets the name of the current thread.
     QString objectName = thr->objectName();
 
@@ -384,10 +378,7 @@ int QThread::idealThreadCount()
 {
     int cores = -1;
 
-#if defined(Q_OS_MAC)
-    // Mac OS X
-    cores = MPProcessorsScheduled();
-#elif defined(Q_OS_HPUX)
+#if defined(Q_OS_HPUX)
     // HP-UX
     struct pst_dynamic psd;
     if (pstat_getdynamic(&psd, sizeof(psd), 1, 0) == -1) {
@@ -409,32 +400,6 @@ int QThread::idealThreadCount()
 #elif defined(Q_OS_IRIX)
     // IRIX
     cores = (int)sysconf(_SC_NPROC_ONLN);
-#elif defined(Q_OS_INTEGRITY)
-#if (__INTEGRITY_MAJOR_VERSION >= 10)
-    // Integrity V10+ does support multicore CPUs
-    Value processorCount;
-    if (GetProcessorCount(CurrentTask(), &processorCount) == 0)
-        cores = processorCount;
-    else
-#endif
-    cores = 1;
-#elif defined(Q_OS_VXWORKS)
-    // VxWorks
-#  if defined(QT_VXWORKS_HAS_CPUSET)
-    cpuset_t cpus = vxCpuEnabledGet();
-    cores = 0;
-
-    // 128 cores should be enough for everyone ;)
-    for (int i = 0; i < 128 && !CPUSET_ISZERO(cpus); ++i) {
-        if (CPUSET_ISSET(cpus, i)) {
-            CPUSET_CLR(cpus, i);
-            cores++;
-        }
-    }
-#  else
-    // as of aug 2008 VxWorks < 6.6 only supports one single core CPU
-    cores = 1;
-#  endif
 #else
     // the rest: Linux, Solaris, AIX, Tru64
     cores = (int)sysconf(_SC_NPROCESSORS_ONLN);
@@ -508,11 +473,6 @@ void QThread::usleep(unsigned long usecs)
 // sched_priority is OUT only
 static bool calculateUnixPriority(int priority, int *sched_policy, int *sched_priority)
 {
-#ifdef Q_OS_QNX
-    // without Round Robin drawn intensive apps will hog the cpu
-    // and make the system appear frozen
-   *sched_policy = SCHED_RR;
-#endif
 #ifdef SCHED_IDLE
     if (priority == QThread::IdlePriority) {
         *sched_policy = SCHED_IDLE;
@@ -525,20 +485,8 @@ static bool calculateUnixPriority(int priority, int *sched_policy, int *sched_pr
 #endif
     const int highestPriority = QThread::TimeCriticalPriority;
 
-    int prio_min;
-    int prio_max;
-#if defined(Q_OS_VXWORKS) && defined(VXWORKS_DKM)
-    // for other scheduling policies than SCHED_RR or SCHED_FIFO
-    prio_min = SCHED_FIFO_LOW_PRI;
-    prio_max = SCHED_FIFO_HIGH_PRI;
-
-    if ((*sched_policy == SCHED_RR) || (*sched_policy == SCHED_FIFO))
-#endif
-    {
-    prio_min = sched_get_priority_min(*sched_policy);
-    prio_max = sched_get_priority_max(*sched_policy);
-    }
-
+    const int prio_min = sched_get_priority_min(*sched_policy);
+    const int prio_max = sched_get_priority_max(*sched_policy);
     if (prio_min == -1 || prio_max == -1)
         return false;