- Timestamp:
- Feb 13, 2010, 1:06:28 AM (15 years ago)
- Location:
- trunk/src/corelib
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/corelib/io/qprocess_os2.cpp
r564 r567 1146 1146 1147 1147 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 } 1151 1152 1152 1153 // cancel STDIN/OUT/ERR redirections -
trunk/src/corelib/io/qsettings_os2.cpp
r564 r567 57 57 extern "C" { 58 58 59 /* No UNICODE support on OS/2 */60 #define QT_WA( uni, ansi ) ansi61 62 59 typedef wchar_t WCHAR; 63 60 typedef WCHAR TCHAR; … … 292 289 HKEY resultHandle = 0; 293 290 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); 303 293 if (res == ERROR_SUCCESS) 304 294 return resultHandle; … … 316 306 317 307 // 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); 327 310 if (res == ERROR_SUCCESS) 328 311 return resultHandle; … … 358 341 { 359 342 QStringList result; 360 LONG res;361 343 DWORD numKeys; 362 344 DWORD maxKeySize; … … 365 347 366 348 // 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); 375 351 if (res != ERROR_SUCCESS) { 376 352 qWarning("QSettings: RegQueryInfoKey() failed with %s", errorCodeToString(res).data()); … … 391 367 } 392 368 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. */ 395 370 ++m; 396 371 397 372 // Get the list 398 QByteArray buff(m *sizeof(ushort), 0);373 QByteArray buff(m, 0); 399 374 for (int i = 0; i < n; ++i) { 400 375 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); 423 383 424 384 if (res != ERROR_SUCCESS) { … … 475 435 476 436 // 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()); 483 438 if (res != ERROR_SUCCESS) { 484 439 qWarning("QSettings: RegDeleteKey(%s): %s", group.toUtf8().data(), … … 652 607 DWORD dataType; 653 608 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); 660 610 if (res != ERROR_SUCCESS) { 661 611 RegCloseKey(handle); … … 665 615 // get the value 666 616 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); 674 619 if (res != ERROR_SUCCESS) { 675 620 RegCloseKey(handle); … … 690 635 QString s; 691 636 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()); 697 638 } 698 639 if (value != 0) … … 706 647 int i = 0; 707 648 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); 714 650 i += s.length() + 1; 715 651 … … 728 664 QString s; 729 665 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()); 735 667 } 736 668 if (value != 0) … … 773 705 { 774 706 if (deleteWriteHandleOnExit && writeHandle() != 0) { 775 #if defined(Q_OS_WINCE)776 remove(regList.at(0).key());777 #else778 DWORD res;779 707 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()); 785 709 if (res != ERROR_SUCCESS) { 786 710 qWarning("QSettings: RegDeleteKey(%s) failed with %s", 787 711 regList.at(0).key().toUtf8().data(), errorCodeToString(res).data()); 788 712 } 789 #endif790 713 } 791 714 … … 807 730 HKEY handle = openKey(writeHandle(), registryPermissions, keyPath(rKey)); 808 731 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()); 814 733 RegCloseKey(handle); 815 734 } … … 826 745 QString group = childKeys.at(i); 827 746 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()); 834 748 if (res != ERROR_SUCCESS) { 835 749 qWarning("QSettings: RegDeleteValue(%s) failed with %s", … … 842 756 RegCloseKey(handle); 843 757 #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()); 850 759 if (res != ERROR_SUCCESS) { 851 760 qWarning("QSettings: RegDeleteKey(%s) failed with %s", … … 910 819 if (type == REG_BINARY) { 911 820 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()); 917 822 } else { 918 823 QStringList::const_iterator it = l.constBegin(); 919 824 for (; it != l.constEnd(); ++it) { 920 825 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); 926 827 } 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); 933 829 } 934 830 break; … … 941 837 break; 942 838 } 839 840 case QVariant::ByteArray: 841 // fallthrough intended 943 842 944 843 default: { … … 948 847 type = stringContainsNullChar(s) ? REG_BINARY : REG_SZ; 949 848 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()); 955 850 } 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); 961 852 } 962 853 break; … … 965 856 966 857 // 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()); 978 861 if (res == ERROR_SUCCESS) { 979 862 deleteWriteHandleOnExit = false; -
trunk/src/corelib/io/qtemporaryfile.cpp
r561 r567 237 237 return 0; 238 238 } else if (domkdir) { 239 #if def Q_OS_WIN239 #if defined(Q_OS_WIN) || defined(Q_OS_OS2) 240 240 if (QT_MKDIR(path) == 0) 241 241 #else -
trunk/src/corelib/tools/qstring.cpp
r561 r567 670 670 significant digits (trailing zeroes are omitted). 671 671 672 \section1 More Efficient String Construction 672 \section1 More Efficient String Construction 673 673 674 674 Using the QString \c{'+'} operator, it is easy to construct a … … 880 880 \since 4.2 881 881 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 883 883 the size of wchar. If wchar is 4 bytes, the \a string is interpreted as ucs-4, 884 884 if wchar is 2 bytes it is interpreted as ucs-2. … … 4648 4648 if (localeObj) { 4649 4649 // 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 == 0x0405014650 // creation of dumb deep copies) which is at least true for <= 4.6.1. 4651 #if QT_VERSION <= 0x040601 4652 4652 return UniStrcoll(localeObj, (UniChar*)data1, (UniChar *)data2); 4653 4653 #else
Note:
See TracChangeset
for help on using the changeset viewer.