Index: /trunk/src/corelib/io/qprocess_os2.cpp
===================================================================
--- /trunk/src/corelib/io/qprocess_os2.cpp	(revision 566)
+++ /trunk/src/corelib/io/qprocess_os2.cpp	(revision 567)
@@ -1146,7 +1146,8 @@
 
     int pid = -1;
-    if (arc == NO_ERROR)
-        pid = qt_startProcess(program, arguments, workingDirectory,
-                              &environment);
+    if (arc == NO_ERROR) {
+        QStringList env = environment.toStringList();
+        pid = qt_startProcess(program, arguments, workingDirectory, &env);
+    }
 
     // cancel STDIN/OUT/ERR redirections
Index: /trunk/src/corelib/io/qsettings_os2.cpp
===================================================================
--- /trunk/src/corelib/io/qsettings_os2.cpp	(revision 566)
+++ /trunk/src/corelib/io/qsettings_os2.cpp	(revision 567)
@@ -57,7 +57,4 @@
 extern "C" {
 
-/* No UNICODE support on OS/2 */
-#define QT_WA( uni, ansi ) ansi
-
 typedef wchar_t WCHAR;
 typedef WCHAR TCHAR;
@@ -292,13 +289,6 @@
     HKEY resultHandle = 0;
 
-    LONG res;
-    QT_WA( {
-        res = RegOpenKeyExW(parentHandle, reinterpret_cast<const wchar_t *>(rSubKey.utf16()),
-                            0, perms, &resultHandle);
-    } , {
-        res = RegOpenKeyExA(parentHandle, rSubKey.toLocal8Bit(),
-                            0, perms, &resultHandle);
-    } );
-
+    LONG res = RegOpenKeyExA(parentHandle, rSubKey.toLocal8Bit(),
+                             0, perms, &resultHandle);
     if (res == ERROR_SUCCESS)
         return resultHandle;
@@ -316,13 +306,6 @@
 
     // try to create it
-    LONG res;
-    QT_WA( {
-        res = RegCreateKeyExW(parentHandle, reinterpret_cast<const wchar_t *>(rSubKey.utf16()), 0, 0,
-                              REG_OPTION_NON_VOLATILE, perms, 0, &resultHandle, 0);
-    } , {
-        res = RegCreateKeyExA(parentHandle, rSubKey.toLocal8Bit(), 0, 0,
-                              REG_OPTION_NON_VOLATILE, perms, 0, &resultHandle, 0);
-    } );
-
+    LONG res = RegCreateKeyExA(parentHandle, rSubKey.toLocal8Bit(), 0, 0,
+                               REG_OPTION_NON_VOLATILE, perms, 0, &resultHandle, 0);
     if (res == ERROR_SUCCESS)
         return resultHandle;
@@ -358,5 +341,4 @@
 {
     QStringList result;
-    LONG res;
     DWORD numKeys;
     DWORD maxKeySize;
@@ -365,12 +347,6 @@
 
     // Find the number of keys and subgroups, as well as the max of their lengths.
-    QT_WA( {
-        res = RegQueryInfoKeyW(parentHandle, 0, 0, 0, &numSubgroups, &maxSubgroupSize, 0,
-                               &numKeys, &maxKeySize, 0, 0, 0);
-    }, {
-        res = RegQueryInfoKeyA(parentHandle, 0, 0, 0, &numSubgroups, &maxSubgroupSize, 0,
-                               &numKeys, &maxKeySize, 0, 0, 0);
-    } );
-
+    LONG res = RegQueryInfoKeyA(parentHandle, 0, 0, 0, &numSubgroups, &maxSubgroupSize, 0,
+                                &numKeys, &maxKeySize, 0, 0, 0);
     if (res != ERROR_SUCCESS) {
         qWarning("QSettings: RegQueryInfoKey() failed with %s", errorCodeToString(res).data());
@@ -391,34 +367,18 @@
     }
 
-    /* Windows NT/2000/XP: The size does not include the terminating null character.
-       Windows Me/98/95: The size includes the terminating null character. */
+    /* The size does not include the terminating null character. */
     ++m;
 
     // Get the list
-    QByteArray buff(m*sizeof(ushort), 0);
+    QByteArray buff(m, 0);
     for (int i = 0; i < n; ++i) {
         QString item;
-        QT_WA( {
-            DWORD l = buff.size() / sizeof(ushort);
-            if (spec == QSettingsPrivate::ChildKeys) {
-                res = RegEnumValueW(parentHandle, i,
-                                    reinterpret_cast<wchar_t *>(buff.data()),
-                                    &l, 0, 0, 0, 0);
-            } else {
-                res = RegEnumKeyExW(parentHandle, i,
-                                    reinterpret_cast<wchar_t *>(buff.data()),
-                                    &l, 0, 0, 0, 0);
-            }
-            if (res == ERROR_SUCCESS)
-                item = QString::fromUtf16(reinterpret_cast<ushort*>(buff.data()), l);
-        }, {
-            DWORD l = buff.size();
-            if (spec == QSettingsPrivate::ChildKeys)
-                res = RegEnumValueA(parentHandle, i, buff.data(), &l, 0, 0, 0, 0);
-            else
-                res = RegEnumKeyExA(parentHandle, i, buff.data(), &l, 0, 0, 0, 0);
-            if (res == ERROR_SUCCESS)
-                item = QString::fromLocal8Bit(buff.data(), l);
-        } );
+        DWORD l = buff.size();
+        if (spec == QSettingsPrivate::ChildKeys)
+            res = RegEnumValueA(parentHandle, i, buff.data(), &l, 0, 0, 0, 0);
+        else
+            res = RegEnumKeyExA(parentHandle, i, buff.data(), &l, 0, 0, 0, 0);
+        if (res == ERROR_SUCCESS)
+            item = QString::fromLocal8Bit(buff.data(), l);
 
         if (res != ERROR_SUCCESS) {
@@ -475,10 +435,5 @@
 
         // delete group itself
-        LONG res;
-        QT_WA( {
-            res = RegDeleteKeyW(parentHandle, reinterpret_cast<const wchar_t *>(group.utf16()));
-        }, {
-            res = RegDeleteKeyA(parentHandle, group.toLocal8Bit());
-        } );
+        LONG res = RegDeleteKeyA(parentHandle, group.toLocal8Bit());
         if (res != ERROR_SUCCESS) {
             qWarning("QSettings: RegDeleteKey(%s): %s", group.toUtf8().data(),
@@ -652,10 +607,5 @@
     DWORD dataType;
     DWORD dataSize;
-    LONG res;
-    QT_WA( {
-        res = RegQueryValueExW(handle, reinterpret_cast<const wchar_t *>(rSubkeyName.utf16()), 0, &dataType, 0, &dataSize);
-    }, {
-        res = RegQueryValueExA(handle, rSubkeyName.toLocal8Bit(), 0, &dataType, 0, &dataSize);
-    } );
+    LONG res = RegQueryValueExA(handle, rSubkeyName.toLocal8Bit(), 0, &dataType, 0, &dataSize);
     if (res != ERROR_SUCCESS) {
         RegCloseKey(handle);
@@ -665,11 +615,6 @@
     // get the value
     QByteArray data(dataSize, 0);
-    QT_WA( {
-        res = RegQueryValueExW(handle, reinterpret_cast<const wchar_t *>(rSubkeyName.utf16()), 0, 0,
-                               reinterpret_cast<unsigned char*>(data.data()), &dataSize);
-    }, {
-        res = RegQueryValueExA(handle, rSubkeyName.toLocal8Bit(), 0, 0,
-                               reinterpret_cast<unsigned char*>(data.data()), &dataSize);
-    } );
+    res = RegQueryValueExA(handle, rSubkeyName.toLocal8Bit(), 0, 0,
+                           reinterpret_cast<unsigned char*>(data.data()), &dataSize);
     if (res != ERROR_SUCCESS) {
         RegCloseKey(handle);
@@ -690,9 +635,5 @@
             QString s;
             if (dataSize) {
-                QT_WA( {
-                    s = QString::fromUtf16(((const ushort*)data.constData()));
-                }, {
-                    s = QString::fromLatin1(data.constData());
-                } );
+                s = QString::fromLatin1(data.constData());
             }
             if (value != 0)
@@ -706,10 +647,5 @@
                 int i = 0;
                 for (;;) {
-                    QString s;
-                    QT_WA( {
-                        s = QString::fromUtf16((const ushort*)data.constData() + i);
-                    }, {
-                        s = QString::fromLocal8Bit(data.constData() + i);
-                    } );
+                    QString s = QString::fromLatin1(data.constData() + i);
                     i += s.length() + 1;
 
@@ -728,9 +664,5 @@
             QString s;
             if (dataSize) {
-                QT_WA( {
-                    s = QString::fromUtf16((const ushort*)data.constData(), data.size()/2);
-                }, {
-                    s = QString::fromLatin1(data.constData(), data.size());
-                } );
+                s = QString::fromLatin1(data.constData(), data.size());
             }
             if (value != 0)
@@ -773,19 +705,10 @@
 {
     if (deleteWriteHandleOnExit && writeHandle() != 0) {
-#if defined(Q_OS_WINCE)
-        remove(regList.at(0).key());
-#else
-        DWORD res;
         QString emptyKey;
-        QT_WA( {
-            res = RegDeleteKeyW(writeHandle(), reinterpret_cast<const wchar_t *>(emptyKey.utf16()));
-        }, {
-            res = RegDeleteKeyA(writeHandle(), emptyKey.toLocal8Bit());
-        } );
+        DWORD res = RegDeleteKeyA(writeHandle(), emptyKey.toLocal8Bit());
         if (res != ERROR_SUCCESS) {
             qWarning("QSettings: RegDeleteKey(%s) failed with %s",
                      regList.at(0).key().toUtf8().data(), errorCodeToString(res).data());
         }
-#endif
     }
 
@@ -807,9 +730,5 @@
     HKEY handle = openKey(writeHandle(), registryPermissions, keyPath(rKey));
     if (handle != 0) {
-        QT_WA( {
-            res = RegDeleteValueW(handle, reinterpret_cast<const wchar_t *>(keyName(rKey).utf16()));
-        }, {
-            res = RegDeleteValueA(handle, keyName(rKey).toLocal8Bit());
-        } );
+        res = RegDeleteValueA(handle, keyName(rKey).toLocal8Bit());
         RegCloseKey(handle);
     }
@@ -826,10 +745,5 @@
                 QString group = childKeys.at(i);
 
-                LONG res;
-                QT_WA( {
-                    res = RegDeleteValueW(handle, reinterpret_cast<const wchar_t *>(group.utf16()));
-                }, {
-                    res = RegDeleteValueA(handle, group.toLocal8Bit());
-                } );
+                LONG res = RegDeleteValueA(handle, group.toLocal8Bit());
                 if (res != ERROR_SUCCESS) {
                     qWarning("QSettings: RegDeleteValue(%s) failed with %s",
@@ -842,10 +756,5 @@
             RegCloseKey(handle);
 #endif
-            QT_WA( {
-                res = RegDeleteKeyW(writeHandle(), reinterpret_cast<const wchar_t *>(rKey.utf16()));
-            }, {
-                res = RegDeleteKeyA(writeHandle(), rKey.toLocal8Bit());
-            } );
-
+            res = RegDeleteKeyA(writeHandle(), rKey.toLocal8Bit());
             if (res != ERROR_SUCCESS) {
                 qWarning("QSettings: RegDeleteKey(%s) failed with %s",
@@ -910,25 +819,12 @@
             if (type == REG_BINARY) {
                 QString s = variantToString(value);
-                QT_WA( {
-                    regValueBuff = QByteArray((const char*)s.utf16(), s.length()*2);
-                }, {
-                    regValueBuff = QByteArray((const char*)s.toLatin1(), s.length());
-                } );
+                regValueBuff = QByteArray((const char*)s.toLatin1(), s.length());
             } else {
                 QStringList::const_iterator it = l.constBegin();
                 for (; it != l.constEnd(); ++it) {
                     const QString &s = *it;
-                    QT_WA( {
-                        regValueBuff += QByteArray((const char*)s.utf16(), (s.length() + 1)*2);
-                    }, {
-                        regValueBuff += QByteArray((const char*)s.toLatin1(), s.length() + 1);
-                    } );
+                    regValueBuff += QByteArray((const char*)s.toLatin1(), s.length() + 1);
                 }
-                QT_WA( {
-                    regValueBuff.append((char)0);
-                    regValueBuff.append((char)0);
-                }, {
-                    regValueBuff.append((char)0);
-                } );
+                regValueBuff.append((char)0);
             }
             break;
@@ -941,4 +837,7 @@
             break;
         }
+
+        case QVariant::ByteArray:
+            // fallthrough intended
 
         default: {
@@ -948,15 +847,7 @@
             type = stringContainsNullChar(s) ? REG_BINARY : REG_SZ;
             if (type == REG_BINARY) {
-                QT_WA( {
-                    regValueBuff = QByteArray((const char*)s.utf16(), s.length()*2);
-                }, {
-                    regValueBuff = QByteArray((const char*)s.toLatin1(), s.length());
-                } );
+                regValueBuff = QByteArray((const char*)s.toLatin1(), s.length());
             } else {
-                QT_WA( {
-                    regValueBuff = QByteArray((const char*)s.utf16(), (s.length() + 1)*2);
-                }, {
-                    regValueBuff = QByteArray((const char*)s.toLatin1(), s.length() + 1);
-                } );
+                regValueBuff = QByteArray((const char*)s.toLatin1(), s.length() + 1);
             }
             break;
@@ -965,15 +856,7 @@
 
     // set the value
-    LONG res;
-    QT_WA( {
-        res = RegSetValueExW(handle, reinterpret_cast<const wchar_t *>(keyName(rKey).utf16()), 0, type,
-                             reinterpret_cast<const unsigned char*>(regValueBuff.constData()),
-                             regValueBuff.size());
-    }, {
-        res = RegSetValueExA(handle, keyName(rKey).toLocal8Bit(), 0, type,
-                             reinterpret_cast<const unsigned char*>(regValueBuff.constData()),
-                             regValueBuff.size());
-    } );
-
+    LONG res = RegSetValueExA(handle, keyName(rKey).toLocal8Bit(), 0, type,
+                              reinterpret_cast<const unsigned char*>(regValueBuff.constData()),
+                              regValueBuff.size());
     if (res == ERROR_SUCCESS) {
         deleteWriteHandleOnExit = false;
Index: /trunk/src/corelib/io/qtemporaryfile.cpp
===================================================================
--- /trunk/src/corelib/io/qtemporaryfile.cpp	(revision 566)
+++ /trunk/src/corelib/io/qtemporaryfile.cpp	(revision 567)
@@ -237,5 +237,5 @@
                 return 0;
         } else if (domkdir) {
-#ifdef Q_OS_WIN
+#if defined(Q_OS_WIN) || defined(Q_OS_OS2)
             if (QT_MKDIR(path) == 0)
 #else
Index: /trunk/src/corelib/tools/qstring.cpp
===================================================================
--- /trunk/src/corelib/tools/qstring.cpp	(revision 566)
+++ /trunk/src/corelib/tools/qstring.cpp	(revision 567)
@@ -670,5 +670,5 @@
     significant digits (trailing zeroes are omitted).
 
-    \section1 More Efficient String Construction 
+    \section1 More Efficient String Construction
 
     Using the QString \c{'+'} operator, it is easy to construct a
@@ -880,5 +880,5 @@
     \since 4.2
 
-    Returns a copy of the \a string, where the encoding of \a string depends on 
+    Returns a copy of the \a string, where the encoding of \a string depends on
     the size of wchar. If wchar is 4 bytes, the \a string is interpreted as ucs-4,
     if wchar is 2 bytes it is interpreted as ucs-2.
@@ -4648,6 +4648,6 @@
     if (localeObj) {
         // note: we assume that data1 and data2 are zero-terminated (to avoid
-        // creation of dumb deep copies) which is at least true for 4.5.1.
-#if QT_VERSION == 0x040501
+        // creation of dumb deep copies) which is at least true for <= 4.6.1.
+#if QT_VERSION <= 0x040601
         return UniStrcoll(localeObj, (UniChar*)data1, (UniChar *)data2);
 #else
