Changeset 567 for trunk/src


Ignore:
Timestamp:
Feb 13, 2010, 1:06:28 AM (15 years ago)
Author:
Dmitry A. Kuminov
Message:

corelib: Adopted to 4.6.1 changes.

Location:
trunk/src/corelib
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/corelib/io/qprocess_os2.cpp

    r564 r567  
    11461146
    11471147    int pid = -1;
    1148     if (arc == NO_ERROR)
    1149         pid = qt_startProcess(program, arguments, workingDirectory,
    1150                               &environment);
     1148    if (arc == NO_ERROR) {
     1149        QStringList env = environment.toStringList();
     1150        pid = qt_startProcess(program, arguments, workingDirectory, &env);
     1151    }
    11511152
    11521153    // cancel STDIN/OUT/ERR redirections
  • trunk/src/corelib/io/qsettings_os2.cpp

    r564 r567  
    5757extern "C" {
    5858
    59 /* No UNICODE support on OS/2 */
    60 #define QT_WA( uni, ansi ) ansi
    61 
    6259typedef wchar_t WCHAR;
    6360typedef WCHAR TCHAR;
     
    292289    HKEY resultHandle = 0;
    293290
    294     LONG res;
    295     QT_WA( {
    296         res = RegOpenKeyExW(parentHandle, reinterpret_cast<const wchar_t *>(rSubKey.utf16()),
    297                             0, perms, &resultHandle);
    298     } , {
    299         res = RegOpenKeyExA(parentHandle, rSubKey.toLocal8Bit(),
    300                             0, perms, &resultHandle);
    301     } );
    302 
     291    LONG res = RegOpenKeyExA(parentHandle, rSubKey.toLocal8Bit(),
     292                             0, perms, &resultHandle);
    303293    if (res == ERROR_SUCCESS)
    304294        return resultHandle;
     
    316306
    317307    // try to create it
    318     LONG res;
    319     QT_WA( {
    320         res = RegCreateKeyExW(parentHandle, reinterpret_cast<const wchar_t *>(rSubKey.utf16()), 0, 0,
    321                               REG_OPTION_NON_VOLATILE, perms, 0, &resultHandle, 0);
    322     } , {
    323         res = RegCreateKeyExA(parentHandle, rSubKey.toLocal8Bit(), 0, 0,
    324                               REG_OPTION_NON_VOLATILE, perms, 0, &resultHandle, 0);
    325     } );
    326 
     308    LONG res = RegCreateKeyExA(parentHandle, rSubKey.toLocal8Bit(), 0, 0,
     309                               REG_OPTION_NON_VOLATILE, perms, 0, &resultHandle, 0);
    327310    if (res == ERROR_SUCCESS)
    328311        return resultHandle;
     
    358341{
    359342    QStringList result;
    360     LONG res;
    361343    DWORD numKeys;
    362344    DWORD maxKeySize;
     
    365347
    366348    // Find the number of keys and subgroups, as well as the max of their lengths.
    367     QT_WA( {
    368         res = RegQueryInfoKeyW(parentHandle, 0, 0, 0, &numSubgroups, &maxSubgroupSize, 0,
    369                                &numKeys, &maxKeySize, 0, 0, 0);
    370     }, {
    371         res = RegQueryInfoKeyA(parentHandle, 0, 0, 0, &numSubgroups, &maxSubgroupSize, 0,
    372                                &numKeys, &maxKeySize, 0, 0, 0);
    373     } );
    374 
     349    LONG res = RegQueryInfoKeyA(parentHandle, 0, 0, 0, &numSubgroups, &maxSubgroupSize, 0,
     350                                &numKeys, &maxKeySize, 0, 0, 0);
    375351    if (res != ERROR_SUCCESS) {
    376352        qWarning("QSettings: RegQueryInfoKey() failed with %s", errorCodeToString(res).data());
     
    391367    }
    392368
    393     /* Windows NT/2000/XP: The size does not include the terminating null character.
    394        Windows Me/98/95: The size includes the terminating null character. */
     369    /* The size does not include the terminating null character. */
    395370    ++m;
    396371
    397372    // Get the list
    398     QByteArray buff(m*sizeof(ushort), 0);
     373    QByteArray buff(m, 0);
    399374    for (int i = 0; i < n; ++i) {
    400375        QString item;
    401         QT_WA( {
    402             DWORD l = buff.size() / sizeof(ushort);
    403             if (spec == QSettingsPrivate::ChildKeys) {
    404                 res = RegEnumValueW(parentHandle, i,
    405                                     reinterpret_cast<wchar_t *>(buff.data()),
    406                                     &l, 0, 0, 0, 0);
    407             } else {
    408                 res = RegEnumKeyExW(parentHandle, i,
    409                                     reinterpret_cast<wchar_t *>(buff.data()),
    410                                     &l, 0, 0, 0, 0);
    411             }
    412             if (res == ERROR_SUCCESS)
    413                 item = QString::fromUtf16(reinterpret_cast<ushort*>(buff.data()), l);
    414         }, {
    415             DWORD l = buff.size();
    416             if (spec == QSettingsPrivate::ChildKeys)
    417                 res = RegEnumValueA(parentHandle, i, buff.data(), &l, 0, 0, 0, 0);
    418             else
    419                 res = RegEnumKeyExA(parentHandle, i, buff.data(), &l, 0, 0, 0, 0);
    420             if (res == ERROR_SUCCESS)
    421                 item = QString::fromLocal8Bit(buff.data(), l);
    422         } );
     376        DWORD l = buff.size();
     377        if (spec == QSettingsPrivate::ChildKeys)
     378            res = RegEnumValueA(parentHandle, i, buff.data(), &l, 0, 0, 0, 0);
     379        else
     380            res = RegEnumKeyExA(parentHandle, i, buff.data(), &l, 0, 0, 0, 0);
     381        if (res == ERROR_SUCCESS)
     382            item = QString::fromLocal8Bit(buff.data(), l);
    423383
    424384        if (res != ERROR_SUCCESS) {
     
    475435
    476436        // delete group itself
    477         LONG res;
    478         QT_WA( {
    479             res = RegDeleteKeyW(parentHandle, reinterpret_cast<const wchar_t *>(group.utf16()));
    480         }, {
    481             res = RegDeleteKeyA(parentHandle, group.toLocal8Bit());
    482         } );
     437        LONG res = RegDeleteKeyA(parentHandle, group.toLocal8Bit());
    483438        if (res != ERROR_SUCCESS) {
    484439            qWarning("QSettings: RegDeleteKey(%s): %s", group.toUtf8().data(),
     
    652607    DWORD dataType;
    653608    DWORD dataSize;
    654     LONG res;
    655     QT_WA( {
    656         res = RegQueryValueExW(handle, reinterpret_cast<const wchar_t *>(rSubkeyName.utf16()), 0, &dataType, 0, &dataSize);
    657     }, {
    658         res = RegQueryValueExA(handle, rSubkeyName.toLocal8Bit(), 0, &dataType, 0, &dataSize);
    659     } );
     609    LONG res = RegQueryValueExA(handle, rSubkeyName.toLocal8Bit(), 0, &dataType, 0, &dataSize);
    660610    if (res != ERROR_SUCCESS) {
    661611        RegCloseKey(handle);
     
    665615    // get the value
    666616    QByteArray data(dataSize, 0);
    667     QT_WA( {
    668         res = RegQueryValueExW(handle, reinterpret_cast<const wchar_t *>(rSubkeyName.utf16()), 0, 0,
    669                                reinterpret_cast<unsigned char*>(data.data()), &dataSize);
    670     }, {
    671         res = RegQueryValueExA(handle, rSubkeyName.toLocal8Bit(), 0, 0,
    672                                reinterpret_cast<unsigned char*>(data.data()), &dataSize);
    673     } );
     617    res = RegQueryValueExA(handle, rSubkeyName.toLocal8Bit(), 0, 0,
     618                           reinterpret_cast<unsigned char*>(data.data()), &dataSize);
    674619    if (res != ERROR_SUCCESS) {
    675620        RegCloseKey(handle);
     
    690635            QString s;
    691636            if (dataSize) {
    692                 QT_WA( {
    693                     s = QString::fromUtf16(((const ushort*)data.constData()));
    694                 }, {
    695                     s = QString::fromLatin1(data.constData());
    696                 } );
     637                s = QString::fromLatin1(data.constData());
    697638            }
    698639            if (value != 0)
     
    706647                int i = 0;
    707648                for (;;) {
    708                     QString s;
    709                     QT_WA( {
    710                         s = QString::fromUtf16((const ushort*)data.constData() + i);
    711                     }, {
    712                         s = QString::fromLocal8Bit(data.constData() + i);
    713                     } );
     649                    QString s = QString::fromLatin1(data.constData() + i);
    714650                    i += s.length() + 1;
    715651
     
    728664            QString s;
    729665            if (dataSize) {
    730                 QT_WA( {
    731                     s = QString::fromUtf16((const ushort*)data.constData(), data.size()/2);
    732                 }, {
    733                     s = QString::fromLatin1(data.constData(), data.size());
    734                 } );
     666                s = QString::fromLatin1(data.constData(), data.size());
    735667            }
    736668            if (value != 0)
     
    773705{
    774706    if (deleteWriteHandleOnExit && writeHandle() != 0) {
    775 #if defined(Q_OS_WINCE)
    776         remove(regList.at(0).key());
    777 #else
    778         DWORD res;
    779707        QString emptyKey;
    780         QT_WA( {
    781             res = RegDeleteKeyW(writeHandle(), reinterpret_cast<const wchar_t *>(emptyKey.utf16()));
    782         }, {
    783             res = RegDeleteKeyA(writeHandle(), emptyKey.toLocal8Bit());
    784         } );
     708        DWORD res = RegDeleteKeyA(writeHandle(), emptyKey.toLocal8Bit());
    785709        if (res != ERROR_SUCCESS) {
    786710            qWarning("QSettings: RegDeleteKey(%s) failed with %s",
    787711                     regList.at(0).key().toUtf8().data(), errorCodeToString(res).data());
    788712        }
    789 #endif
    790713    }
    791714
     
    807730    HKEY handle = openKey(writeHandle(), registryPermissions, keyPath(rKey));
    808731    if (handle != 0) {
    809         QT_WA( {
    810             res = RegDeleteValueW(handle, reinterpret_cast<const wchar_t *>(keyName(rKey).utf16()));
    811         }, {
    812             res = RegDeleteValueA(handle, keyName(rKey).toLocal8Bit());
    813         } );
     732        res = RegDeleteValueA(handle, keyName(rKey).toLocal8Bit());
    814733        RegCloseKey(handle);
    815734    }
     
    826745                QString group = childKeys.at(i);
    827746
    828                 LONG res;
    829                 QT_WA( {
    830                     res = RegDeleteValueW(handle, reinterpret_cast<const wchar_t *>(group.utf16()));
    831                 }, {
    832                     res = RegDeleteValueA(handle, group.toLocal8Bit());
    833                 } );
     747                LONG res = RegDeleteValueA(handle, group.toLocal8Bit());
    834748                if (res != ERROR_SUCCESS) {
    835749                    qWarning("QSettings: RegDeleteValue(%s) failed with %s",
     
    842756            RegCloseKey(handle);
    843757#endif
    844             QT_WA( {
    845                 res = RegDeleteKeyW(writeHandle(), reinterpret_cast<const wchar_t *>(rKey.utf16()));
    846             }, {
    847                 res = RegDeleteKeyA(writeHandle(), rKey.toLocal8Bit());
    848             } );
    849 
     758            res = RegDeleteKeyA(writeHandle(), rKey.toLocal8Bit());
    850759            if (res != ERROR_SUCCESS) {
    851760                qWarning("QSettings: RegDeleteKey(%s) failed with %s",
     
    910819            if (type == REG_BINARY) {
    911820                QString s = variantToString(value);
    912                 QT_WA( {
    913                     regValueBuff = QByteArray((const char*)s.utf16(), s.length()*2);
    914                 }, {
    915                     regValueBuff = QByteArray((const char*)s.toLatin1(), s.length());
    916                 } );
     821                regValueBuff = QByteArray((const char*)s.toLatin1(), s.length());
    917822            } else {
    918823                QStringList::const_iterator it = l.constBegin();
    919824                for (; it != l.constEnd(); ++it) {
    920825                    const QString &s = *it;
    921                     QT_WA( {
    922                         regValueBuff += QByteArray((const char*)s.utf16(), (s.length() + 1)*2);
    923                     }, {
    924                         regValueBuff += QByteArray((const char*)s.toLatin1(), s.length() + 1);
    925                     } );
     826                    regValueBuff += QByteArray((const char*)s.toLatin1(), s.length() + 1);
    926827                }
    927                 QT_WA( {
    928                     regValueBuff.append((char)0);
    929                     regValueBuff.append((char)0);
    930                 }, {
    931                     regValueBuff.append((char)0);
    932                 } );
     828                regValueBuff.append((char)0);
    933829            }
    934830            break;
     
    941837            break;
    942838        }
     839
     840        case QVariant::ByteArray:
     841            // fallthrough intended
    943842
    944843        default: {
     
    948847            type = stringContainsNullChar(s) ? REG_BINARY : REG_SZ;
    949848            if (type == REG_BINARY) {
    950                 QT_WA( {
    951                     regValueBuff = QByteArray((const char*)s.utf16(), s.length()*2);
    952                 }, {
    953                     regValueBuff = QByteArray((const char*)s.toLatin1(), s.length());
    954                 } );
     849                regValueBuff = QByteArray((const char*)s.toLatin1(), s.length());
    955850            } else {
    956                 QT_WA( {
    957                     regValueBuff = QByteArray((const char*)s.utf16(), (s.length() + 1)*2);
    958                 }, {
    959                     regValueBuff = QByteArray((const char*)s.toLatin1(), s.length() + 1);
    960                 } );
     851                regValueBuff = QByteArray((const char*)s.toLatin1(), s.length() + 1);
    961852            }
    962853            break;
     
    965856
    966857    // set the value
    967     LONG res;
    968     QT_WA( {
    969         res = RegSetValueExW(handle, reinterpret_cast<const wchar_t *>(keyName(rKey).utf16()), 0, type,
    970                              reinterpret_cast<const unsigned char*>(regValueBuff.constData()),
    971                              regValueBuff.size());
    972     }, {
    973         res = RegSetValueExA(handle, keyName(rKey).toLocal8Bit(), 0, type,
    974                              reinterpret_cast<const unsigned char*>(regValueBuff.constData()),
    975                              regValueBuff.size());
    976     } );
    977 
     858    LONG res = RegSetValueExA(handle, keyName(rKey).toLocal8Bit(), 0, type,
     859                              reinterpret_cast<const unsigned char*>(regValueBuff.constData()),
     860                              regValueBuff.size());
    978861    if (res == ERROR_SUCCESS) {
    979862        deleteWriteHandleOnExit = false;
  • trunk/src/corelib/io/qtemporaryfile.cpp

    r561 r567  
    237237                return 0;
    238238        } else if (domkdir) {
    239 #ifdef Q_OS_WIN
     239#if defined(Q_OS_WIN) || defined(Q_OS_OS2)
    240240            if (QT_MKDIR(path) == 0)
    241241#else
  • trunk/src/corelib/tools/qstring.cpp

    r561 r567  
    670670    significant digits (trailing zeroes are omitted).
    671671
    672     \section1 More Efficient String Construction 
     672    \section1 More Efficient String Construction
    673673
    674674    Using the QString \c{'+'} operator, it is easy to construct a
     
    880880    \since 4.2
    881881
    882     Returns a copy of the \a string, where the encoding of \a string depends on 
     882    Returns a copy of the \a string, where the encoding of \a string depends on
    883883    the size of wchar. If wchar is 4 bytes, the \a string is interpreted as ucs-4,
    884884    if wchar is 2 bytes it is interpreted as ucs-2.
     
    46484648    if (localeObj) {
    46494649        // note: we assume that data1 and data2 are zero-terminated (to avoid
    4650         // creation of dumb deep copies) which is at least true for 4.5.1.
    4651 #if QT_VERSION == 0x040501
     4650        // creation of dumb deep copies) which is at least true for <= 4.6.1.
     4651#if QT_VERSION <= 0x040601
    46524652        return UniStrcoll(localeObj, (UniChar*)data1, (UniChar *)data2);
    46534653#else
Note: See TracChangeset for help on using the changeset viewer.