summaryrefslogtreecommitdiff
path: root/qmake/tools
Unidiff
Diffstat (limited to 'qmake/tools') (more/less context) (ignore whitespace changes)
-rw-r--r--qmake/tools/qbitarray.cpp3
-rw-r--r--qmake/tools/qbuffer.cpp4
-rw-r--r--qmake/tools/qcomlibrary.cpp43
-rw-r--r--qmake/tools/qconfig.cpp14
-rw-r--r--qmake/tools/qcriticalsection_p.cpp2
-rw-r--r--qmake/tools/qcstring.cpp107
-rw-r--r--qmake/tools/qdatastream.cpp24
-rw-r--r--qmake/tools/qdatetime.cpp70
-rw-r--r--qmake/tools/qdir.cpp94
-rw-r--r--qmake/tools/qdir_unix.cpp54
-rw-r--r--qmake/tools/qfile.cpp3
-rw-r--r--qmake/tools/qfile_unix.cpp13
-rw-r--r--qmake/tools/qfileinfo.cpp4
-rw-r--r--qmake/tools/qfileinfo_unix.cpp4
-rw-r--r--qmake/tools/qgarray.cpp97
-rw-r--r--qmake/tools/qgdict.cpp5
-rw-r--r--qmake/tools/qglist.cpp6
-rw-r--r--qmake/tools/qglobal.cpp45
-rw-r--r--qmake/tools/qgpluginmanager.cpp4
-rw-r--r--qmake/tools/qgvector.cpp9
-rw-r--r--qmake/tools/qlibrary.cpp13
-rw-r--r--qmake/tools/qlibrary_unix.cpp21
-rw-r--r--qmake/tools/qmutex_unix.cpp8
-rw-r--r--qmake/tools/qmutexpool.cpp78
-rw-r--r--qmake/tools/qregexp.cpp70
-rw-r--r--qmake/tools/qsemaphore_unix.cpp26
-rw-r--r--qmake/tools/qsettings.cpp387
-rw-r--r--qmake/tools/qstring.cpp434
-rw-r--r--qmake/tools/qtextstream.cpp2
-rw-r--r--qmake/tools/qucom.cpp136
-rw-r--r--qmake/tools/qwaitcondition_unix.cpp13
31 files changed, 1115 insertions, 678 deletions
diff --git a/qmake/tools/qbitarray.cpp b/qmake/tools/qbitarray.cpp
index 4f4e14b..1aaf963 100644
--- a/qmake/tools/qbitarray.cpp
+++ b/qmake/tools/qbitarray.cpp
@@ -199,3 +199,4 @@ void QBitArray::pad0()
199 Resizes the bit array to \a size bits and returns TRUE if the bit 199 Resizes the bit array to \a size bits and returns TRUE if the bit
200 array could be resized; otherwise returns FALSE. 200 array could be resized; otherwise returns FALSE. The array becomes
201 a null array if \a size == 0.
201 202
diff --git a/qmake/tools/qbuffer.cpp b/qmake/tools/qbuffer.cpp
index b213dd9..0fc90e4 100644
--- a/qmake/tools/qbuffer.cpp
+++ b/qmake/tools/qbuffer.cpp
@@ -198,4 +198,4 @@ bool QBuffer::open( int m )
198 if ( m & IO_Truncate ) { // truncate buffer 198 if ( m & IO_Truncate ) { // truncate buffer
199 a.resize( 0 ); 199 a.resize( 1 );
200 a_len = 0; 200 a_len = 1;
201 } 201 }
diff --git a/qmake/tools/qcomlibrary.cpp b/qmake/tools/qcomlibrary.cpp
index a7162fc..2a1b75a 100644
--- a/qmake/tools/qcomlibrary.cpp
+++ b/qmake/tools/qcomlibrary.cpp
@@ -65,2 +65,6 @@ QComLibrary::~QComLibrary()
65 unload(); 65 unload();
66 if ( libiface )
67 libiface->release();
68 if ( entry )
69 entry->release();
66} 70}
@@ -393,25 +397,23 @@ void QComLibrary::createInstanceInternal()
393 397
394 if ( ! query_done ) {
395
396#ifdef QT_THREAD_SUPPORT 398#ifdef QT_THREAD_SUPPORT
397 QMutexLocker locker( qt_global_mutexpool->get( &cache ) ); 399 QMutexLocker locker( qt_global_mutexpool ?
400 qt_global_mutexpool->get( &cache ) : 0 );
398#endif // QT_THREAD_SUPPORT 401#endif // QT_THREAD_SUPPORT
399 402
400 if ( ! cache ) { 403 if ( ! cache ) {
401 cache = new QSettings; 404 cache = new QSettings;
402 cache->insertSearchPath( QSettings::Windows, "/Trolltech" ); 405 cache->insertSearchPath( QSettings::Windows, "/Trolltech" );
403 cleanup_cache.set( &cache ); 406 cleanup_cache.set( &cache );
404 } 407 }
405 408
406 reg = cache->readListEntry( regkey ); 409 reg = cache->readListEntry( regkey );
407 if ( reg.count() == 4 ) { 410 if ( reg.count() == 4 ) {
408 // check timestamp 411 // check timestamp
409 if ( lastModified == reg[3] ) { 412 if ( lastModified == reg[3] ) {
410 qt_version = reg[0].toUInt(0, 16); 413 qt_version = reg[0].toUInt(0, 16);
411 flags = reg[1].toUInt(0, 16); 414 flags = reg[1].toUInt(0, 16);
412 key = reg[2].latin1(); 415 key = reg[2].latin1();
413 416
414 query_done = TRUE; 417 query_done = TRUE;
415 warn_mismatch = FALSE; 418 warn_mismatch = FALSE;
416 }
417 } 419 }
@@ -463,7 +465,2 @@ void QComLibrary::createInstanceInternal()
463 if ( queried != reg ) { 465 if ( queried != reg ) {
464
465#ifdef QT_THREAD_SUPPORT
466 QMutexLocker locker( qt_global_mutexpool->get( &cache ) );
467#endif // QT_THREAD_SUPPORT
468
469 cache->writeEntry( regkey, queried ); 466 cache->writeEntry( regkey, queried );
diff --git a/qmake/tools/qconfig.cpp b/qmake/tools/qconfig.cpp
index 433827c..5297a4e 100644
--- a/qmake/tools/qconfig.cpp
+++ b/qmake/tools/qconfig.cpp
@@ -2,9 +2,9 @@
2 2
3static const char QT_INSTALL_PREFIX [256] = "/usr/src/coding/projects/userspace/qt-embedded-free-3.1.0-b2"; 3static const char QT_INSTALL_PREFIX [256] = "/opt/qt-x11-free-3.1.2";
4static const char QT_INSTALL_BINS [256] = "/usr/src/coding/projects/userspace/qt-embedded-free-3.1.0-b2/bin"; 4static const char QT_INSTALL_BINS [256] = "/opt/qt-x11-free-3.1.2/bin";
5static const char QT_INSTALL_DOCS [256] = "/usr/src/coding/projects/userspace/qt-embedded-free-3.1.0-b2/doc"; 5static const char QT_INSTALL_DOCS [256] = "/opt/qt-x11-free-3.1.2/doc";
6static const char QT_INSTALL_HEADERS[256] = "/usr/src/coding/projects/userspace/qt-embedded-free-3.1.0-b2/include"; 6static const char QT_INSTALL_HEADERS[256] = "/opt/qt-x11-free-3.1.2/include";
7static const char QT_INSTALL_LIBS [256] = "/usr/src/coding/projects/userspace/qt-embedded-free-3.1.0-b2/lib"; 7static const char QT_INSTALL_LIBS [256] = "/opt/qt-x11-free-3.1.2/lib";
8static const char QT_INSTALL_PLUGINS[256] = "/usr/src/coding/projects/userspace/qt-embedded-free-3.1.0-b2/plugins"; 8static const char QT_INSTALL_PLUGINS[256] = "/opt/qt-x11-free-3.1.2/plugins";
9static const char QT_INSTALL_DATA [256] = "/usr/src/coding/projects/userspace/qt-embedded-free-3.1.0-b2"; 9static const char QT_INSTALL_DATA [256] = "/opt/qt-x11-free-3.1.2";
10 10
diff --git a/qmake/tools/qcriticalsection_p.cpp b/qmake/tools/qcriticalsection_p.cpp
index 60fc8bd..c375730 100644
--- a/qmake/tools/qcriticalsection_p.cpp
+++ b/qmake/tools/qcriticalsection_p.cpp
@@ -5,4 +5,2 @@
5** 5**
6** Created :
7**
8** Copyright (C) 2001 Trolltech AS. All rights reserved. 6** Copyright (C) 2001 Trolltech AS. All rights reserved.
diff --git a/qmake/tools/qcstring.cpp b/qmake/tools/qcstring.cpp
index cf1b853..4651b97 100644
--- a/qmake/tools/qcstring.cpp
+++ b/qmake/tools/qcstring.cpp
@@ -143,2 +143,13 @@ char *qstrncpy( char *dst, const char *src, uint len )
143/*! 143/*!
144 \fn uint qstrlen( const char *str );
145
146 \relates QCString
147
148 A safe strlen function.
149
150 Returns the number of characters that precede the terminating '\0'.
151 or 0 if \a str is 0.
152*/
153
154/*!
144 \fn int qstrcmp( const char *str1, const char *str2 ); 155 \fn int qstrcmp( const char *str1, const char *str2 );
@@ -301,3 +312,4 @@ Q_UINT16 qChecksum( const char *data, uint len )
301#ifdef QT_THREAD_SUPPORT 312#ifdef QT_THREAD_SUPPORT
302 QMutexLocker locker( qt_global_mutexpool->get( &crc_tbl_init ) ); 313 QMutexLocker locker( qt_global_mutexpool ?
314 qt_global_mutexpool->get( &crc_tbl_init ) : 0 );
303#endif // QT_THREAD_SUPPORT 315#endif // QT_THREAD_SUPPORT
@@ -321,5 +333,11 @@ Q_UINT16 qChecksum( const char *data, uint len )
321 333
322/*! \fn QByteArray qCompress( const QByteArray& data) 334/*!
323 \relates QByteArray 335 \fn QByteArray qCompress( const QByteArray& data )
324 \overload 336
337 \relates QByteArray
338
339 Compresses the array \a data and returns the compressed byte
340 array.
341
342 \sa qUncompress()
325*/ 343*/
@@ -327,8 +345,8 @@ Q_UINT16 qChecksum( const char *data, uint len )
327/*! 345/*!
328 \relates QByteArray 346 \relates QByteArray
329 347
330 Compresses the array \a data which is \a nbytes long and returns the 348 \overload
331 compressed byte array.
332 349
333 \sa qUncompress() 350 Compresses the array \a data which is \a nbytes long and returns the
351 compressed byte array.
334*/ 352*/
@@ -381,5 +399,19 @@ QByteArray qCompress( const uchar* data, int nbytes )
381 399
382/*! \fn QByteArray qUncompress( const QByteArray& data ) 400/*!
383 \relates QByteArray 401 \fn QByteArray qUncompress( const QByteArray& data )
384 \overload 402
403 \relates QByteArray
404
405 Uncompresses the array \a data and returns the uncompressed byte
406 array.
407
408 Returns an empty QByteArray if the input data was corrupt.
409 \omit
410 ADD THE FOLLOWING FOR Qt 4.0
411 This function will uncompress data compressed with qCompress()
412 from this and any earlier Qt version, back to Qt 3.1 when this
413 feature was added.
414 \endomit
415
416 \sa qCompress()
385*/ 417*/
@@ -387,10 +419,8 @@ QByteArray qCompress( const uchar* data, int nbytes )
387/*! 419/*!
388 \relates QByteArray 420 \relates QByteArray
389
390 Uncompresses the array \a data which is \a nbytes long and returns
391 the uncompressed byte array.
392 421
393 Returns an empty QByteArray if the input data was corrupt. 422 \overload
394 423
395 \sa qCompress() 424 Uncompresses the array \a data which is \a nbytes long and returns
425 the uncompressed byte array.
396*/ 426*/
@@ -938,2 +968,7 @@ int QCString::find( const char *str, int index, bool cs ) const
938{ 968{
969 return find( str, index, cs, length() );
970}
971
972int QCString::find( const char *str, int index, bool cs, uint l ) const
973{
939 if ( (uint)index >= size() ) 974 if ( (uint)index >= size() )
@@ -944,3 +979,2 @@ int QCString::find( const char *str, int index, bool cs ) const
944 return index; 979 return index;
945 const uint l = length();
946 const uint sl = qstrlen( str ); 980 const uint sl = qstrlen( str );
@@ -1154,4 +1188,5 @@ int QCString::contains( const char *str, bool cs ) const
1154 int i = -1; 1188 int i = -1;
1189 uint l = length();
1155 // use find for the faster hashing algorithm 1190 // use find for the faster hashing algorithm
1156 while ( ( i = find ( str, i+1, cs ) ) != -1 ) 1191 while ( ( i = find ( str, i+1, cs, l ) ) != -1 )
1157 count++; 1192 count++;
@@ -1175,3 +1210,2 @@ int QCString::contains( const char *str, bool cs ) const
1175*/ 1210*/
1176
1177QCString QCString::left( uint len ) const 1211QCString QCString::left( uint len ) const
@@ -1499,3 +1533,3 @@ QCString &QCString::insert( uint index, const char *s )
1499 detach(); 1533 detach();
1500 if ( QByteArray::resize(nlen+index-olen+1) ) { 1534 if ( QByteArray::resize(nlen+index-olen+1, QByteArray::SpeedOptim ) ) {
1501 memset( data()+olen, ' ', index-olen ); 1535 memset( data()+olen, ' ', index-olen );
@@ -1503,6 +1537,8 @@ QCString &QCString::insert( uint index, const char *s )
1503 } 1537 }
1504 } else if ( QByteArray::resize(nlen+1) ) {// normal insert 1538 } else {
1505 detach(); 1539 detach();
1506 memmove( data()+index+len, data()+index, olen-index+1 ); 1540 if ( QByteArray::resize(nlen+1, QByteArray::SpeedOptim ) ) {// normal insert
1507 memcpy( data()+index, s, len ); 1541 memmove( data()+index+len, data()+index, olen-index+1 );
1542 memcpy( data()+index, s, len );
1543 }
1508 } 1544 }
@@ -1571,3 +1607,3 @@ QCString &QCString::remove( uint index, uint len )
1571 memmove( data()+index, data()+index+len, olen-index-len+1 ); 1607 memmove( data()+index, data()+index+len, olen-index-len+1 );
1572 QByteArray::resize(olen-len+1); 1608 QByteArray::resize(olen-len+1, QByteArray::SpeedOptim );
1573 } 1609 }
@@ -1633,2 +1669,3 @@ QCString &QCString::replace( char c, const char *after )
1633*/ 1669*/
1670
1634QCString &QCString::replace( const char *before, const char *after ) 1671QCString &QCString::replace( const char *before, const char *after )
@@ -1648,3 +1685,3 @@ QCString &QCString::replace( const char *before, const char *after )
1648 if ( bl ) { 1685 if ( bl ) {
1649 while( (index = find( before, index ) ) != -1 ) { 1686 while( (index = find( before, index, TRUE, len ) ) != -1 ) {
1650 memcpy( d+index, after, al ); 1687 memcpy( d+index, after, al );
@@ -1657,3 +1694,3 @@ QCString &QCString::replace( const char *before, const char *after )
1657 uint num = 0; 1694 uint num = 0;
1658 while( (index = find( before, index ) ) != -1 ) { 1695 while( (index = find( before, index, TRUE, len ) ) != -1 ) {
1659 if ( num ) { 1696 if ( num ) {
@@ -1688,3 +1725,3 @@ QCString &QCString::replace( const char *before, const char *after )
1688 while( pos < 4095 ) { 1725 while( pos < 4095 ) {
1689 index = find(before, index); 1726 index = find(before, index, TRUE, len);
1690 if ( index == -1 ) 1727 if ( index == -1 )
@@ -1765,3 +1802,3 @@ int QCString::find( const QRegExp& rx, int index ) const
1765{ 1802{
1766 QString d = QString::fromLatin1( data() ); 1803 QString d = QString::fromAscii( data() );
1767 return d.find( rx, index ); 1804 return d.find( rx, index );
@@ -1785,3 +1822,3 @@ int QCString::findRev( const QRegExp& rx, int index ) const
1785{ 1822{
1786 QString d = QString::fromLatin1( data() ); 1823 QString d = QString::fromAscii( data() );
1787 return d.findRev( rx, index ); 1824 return d.findRev( rx, index );
@@ -1810,3 +1847,3 @@ int QCString::contains( const QRegExp &rx ) const
1810{ 1847{
1811 QString d = QString::fromLatin1( data() ); 1848 QString d = QString::fromAscii( data() );
1812 return d.contains( rx ); 1849 return d.contains( rx );
@@ -1840,4 +1877,4 @@ QCString &QCString::replace( const QRegExp &rx, const char *str )
1840{ 1877{
1841 QString d = QString::fromLatin1( data() ); 1878 QString d = QString::fromAscii( data() );
1842 QString r = QString::fromLatin1( str ); 1879 QString r = QString::fromAscii( str );
1843 d.replace( rx, r ); 1880 d.replace( rx, r );
@@ -2201,3 +2238,3 @@ QCString& QCString::operator+=( const char *str )
2201 uint len2 = qstrlen(str); 2238 uint len2 = qstrlen(str);
2202 if ( !QByteArray::resize( len1 + len2 + 1 ) ) 2239 if ( !QByteArray::resize( len1 + len2 + 1, QByteArray::SpeedOptim ) )
2203 return *this; // no memory 2240 return *this; // no memory
@@ -2217,3 +2254,3 @@ QCString &QCString::operator+=( char c )
2217 uint len = length(); 2254 uint len = length();
2218 if ( !QByteArray::resize( len + 2 ) ) 2255 if ( !QByteArray::resize( len + 2, QByteArray::SpeedOptim ) )
2219 return *this; // no memory 2256 return *this; // no memory
diff --git a/qmake/tools/qdatastream.cpp b/qmake/tools/qdatastream.cpp
index 9c573c7..51a1448 100644
--- a/qmake/tools/qdatastream.cpp
+++ b/qmake/tools/qdatastream.cpp
@@ -752,4 +752,12 @@ QDataStream &QDataStream::readRawBytes( char *s, uint len )
752 register Q_INT8 *p = (Q_INT8*)s; 752 register Q_INT8 *p = (Q_INT8*)s;
753 while ( len-- ) 753 if ( version() < 4 ) {
754 *this >> *p++; 754 while ( len-- ) {
755 Q_INT32 tmp;
756 *this >> tmp;
757 *p++ = tmp;
758 }
759 } else {
760 while ( len-- )
761 *this >> *p++;
762 }
755 } else { // read data char array 763 } else { // read data char array
@@ -1014,5 +1022,11 @@ QDataStream &QDataStream::writeRawBytes( const char *s, uint len )
1014 if ( printable ) { // write printable 1022 if ( printable ) { // write printable
1015 register Q_INT8 *p = (Q_INT8*)s; 1023 if ( version() < 4 ) {
1016 while ( len-- ) 1024 register char *p = (char *)s;
1017 *this << *p++; 1025 while ( len-- )
1026 *this << *p++;
1027 } else {
1028 register Q_INT8 *p = (Q_INT8*)s;
1029 while ( len-- )
1030 *this << *p++;
1031 }
1018 } else { // write data char array 1032 } else { // write data char array
diff --git a/qmake/tools/qdatetime.cpp b/qmake/tools/qdatetime.cpp
index 93e40a8..3137877 100644
--- a/qmake/tools/qdatetime.cpp
+++ b/qmake/tools/qdatetime.cpp
@@ -7,3 +7,3 @@
7** 7**
8** Copyright (C) 1992-2000 Trolltech AS. All rights reserved. 8** Copyright (C) 1992-2002 Trolltech AS. All rights reserved.
9** 9**
@@ -37,3 +37,2 @@
37 37
38// Get the system specific includes and defines
39#include "qplatformdefs.h" 38#include "qplatformdefs.h"
@@ -897,2 +896,8 @@ QDate QDate::addYears( int nyears ) const
897 y += nyears; 896 y += nyears;
897
898 QDate tmp(y,m,1);
899
900 if( d > tmp.daysInMonth() )
901 d = tmp.daysInMonth();
902
898 QDate date(y, m, d); 903 QDate date(y, m, d);
@@ -992,2 +997,3 @@ QDate QDate::currentDate( Qt::TimeSpec ts )
992#else 997#else
998 // posix compliant system
993 time_t ltime; 999 time_t ltime;
@@ -995,6 +1001,17 @@ QDate QDate::currentDate( Qt::TimeSpec ts )
995 tm *t; 1001 tm *t;
1002
1003# if defined(QT_THREAD_SUPPORT) && defined(_POSIX_THREAD_SAFE_FUNCTIONS)
1004 // use the reentrant versions of localtime() and gmtime() where available
1005 tm res;
1006 if ( ts == Qt::LocalTime )
1007 t = localtime_r( &ltime, &res );
1008 else
1009 t = gmtime_r( &ltime, &res );
1010# else
996 if ( ts == Qt::LocalTime ) 1011 if ( ts == Qt::LocalTime )
997 t = localtime( &ltime ); 1012 t = localtime( &ltime );
998 else 1013 else
999 t = gmtime( &ltime ); 1014 t = gmtime( &ltime );
1015# endif // QT_THREAD_SUPPORT && _POSIX_THREAD_SAFE_FUNCTIONS
1016
1000 d.jd = gregorianToJulian( t->tm_year + 1900, t->tm_mon + 1, t->tm_mday ); 1017 d.jd = gregorianToJulian( t->tm_year + 1900, t->tm_mon + 1, t->tm_mday );
@@ -1557,3 +1574,3 @@ int QTime::msecsTo( const QTime &t ) const
1557 1574
1558/*! 1575/*!
1559 \overload 1576 \overload
@@ -1655,2 +1672,3 @@ bool QTime::currentTime( QTime *ct, Qt::TimeSpec ts )
1655#elif defined(Q_OS_UNIX) 1672#elif defined(Q_OS_UNIX)
1673 // posix compliant system
1656 struct timeval tv; 1674 struct timeval tv;
@@ -1659,7 +1677,17 @@ bool QTime::currentTime( QTime *ct, Qt::TimeSpec ts )
1659 tm *t; 1677 tm *t;
1660 if ( ts == Qt::LocalTime ) { 1678
1679# if defined(QT_THREAD_SUPPORT) && defined(_POSIX_THREAD_SAFE_FUNCTIONS)
1680 // use the reentrant versions of localtime() and gmtime() where available
1681 tm res;
1682 if ( ts == Qt::LocalTime )
1683 t = localtime_r( &ltime, &res );
1684 else
1685 t = gmtime_r( &ltime, &res );
1686# else
1687 if ( ts == Qt::LocalTime )
1661 t = localtime( &ltime ); 1688 t = localtime( &ltime );
1662 } else { 1689 else
1663 t = gmtime( &ltime ); 1690 t = gmtime( &ltime );
1664 } 1691# endif // QT_THREAD_SUPPORT && _POSIX_THREAD_SAFE_FUNCTIONS
1692
1665 ct->ds = (uint)( MSECS_PER_HOUR * t->tm_hour + MSECS_PER_MIN * t->tm_min + 1693 ct->ds = (uint)( MSECS_PER_HOUR * t->tm_hour + MSECS_PER_MIN * t->tm_min +
@@ -1670,3 +1698,3 @@ bool QTime::currentTime( QTime *ct, Qt::TimeSpec ts )
1670 tm *t; 1698 tm *t;
1671 if ( ts == Qt::LocalTime ) 1699 if ( ts == Qt::LocalTime )
1672 localtime( &ltime ); 1700 localtime( &ltime );
@@ -1708,5 +1736,5 @@ bool QTime::isValid( int h, int m, int s, int ms )
1708 QTime t; 1736 QTime t;
1709 t.start(); // start clock 1737 t.start();
1710 ... // some lengthy task 1738 some_lengthy_task();
1711 qDebug( "%d\n", t.elapsed() ); // prints the number of msecs elapsed 1739 qDebug( "Time elapsed: %d ms", t.elapsed() );
1712 \endcode 1740 \endcode
@@ -1962,2 +1990,18 @@ void QDateTime::setTime_t( uint secsSince1Jan1970UTC, Qt::TimeSpec ts )
1962 tm *brokenDown = 0; 1990 tm *brokenDown = 0;
1991
1992#if defined(Q_OS_UNIX) && defined(QT_THREAD_SUPPORT) && defined(_POSIX_THREAD_SAFE_FUNCTIONS)
1993 // posix compliant system
1994 // use the reentrant versions of localtime() and gmtime() where available
1995 tm res;
1996 if ( ts == Qt::LocalTime )
1997 brokenDown = localtime_r( &tmp, &res );
1998 if ( !brokenDown ) {
1999 brokenDown = gmtime_r( &tmp, &res );
2000 if ( !brokenDown ) {
2001 d.jd = QDate::gregorianToJulian( 1970, 1, 1 );
2002 t.ds = 0;
2003 return;
2004 }
2005 }
2006#else
1963 if ( ts == Qt::LocalTime ) 2007 if ( ts == Qt::LocalTime )
@@ -1972,2 +2016,4 @@ void QDateTime::setTime_t( uint secsSince1Jan1970UTC, Qt::TimeSpec ts )
1972 } 2016 }
2017#endif
2018
1973 d.jd = QDate::gregorianToJulian( brokenDown->tm_year + 1900, 2019 d.jd = QDate::gregorianToJulian( brokenDown->tm_year + 1900,
@@ -2302,3 +2348,3 @@ bool QDateTime::operator>=( const QDateTime &dt ) const
2302 \overload 2348 \overload
2303 2349
2304 Returns the current datetime, as reported by the system clock. 2350 Returns the current datetime, as reported by the system clock.
diff --git a/qmake/tools/qdir.cpp b/qmake/tools/qdir.cpp
index 418ea49..5714878 100644
--- a/qmake/tools/qdir.cpp
+++ b/qmake/tools/qdir.cpp
@@ -7,3 +7,3 @@
7** 7**
8** Copyright (C) 1992-2002 Trolltech AS. All rights reserved. 8** Copyright (C) 1992-2003 Trolltech AS. All rights reserved.
9** 9**
@@ -45,5 +45,9 @@
45#include "qstringlist.h" 45#include "qstringlist.h"
46#include <stdlib.h> 46#include <limits.h>
47#include <ctype.h>
48 47
48#if defined(Q_FS_FAT) && !defined(Q_OS_UNIX)
49const bool CaseSensitiveFS = FALSE;
50#else
51const bool CaseSensitiveFS = TRUE;
52#endif
49 53
@@ -52,2 +56,3 @@
52 \class QDir 56 \class QDir
57 \reentrant
53 \brief The QDir class provides access to directory structures and their contents in a platform-independent way. 58 \brief The QDir class provides access to directory structures and their contents in a platform-independent way.
@@ -232,2 +237,10 @@ QDir::QDir( const QDir &d )
232 237
238/*!
239 Refreshes the directory information.
240*/
241void QDir::refresh() const
242{
243 QDir* that = (QDir*) this;
244 that->dirty = TRUE;
245}
233 246
@@ -384,6 +397,32 @@ QString QDir::absFilePath( const QString &fileName,
384 QString tmp = absPath(); 397 QString tmp = absPath();
385 if ( tmp.isEmpty() || (tmp[(int)tmp.length()-1] != '/' && !!fileName && 398#ifdef Q_OS_WIN32
386 fileName[0] != '/') ) 399 if ( fileName[0].isLetter() && fileName[1] == ':' ) {
387 tmp += '/'; 400 int drv = fileName.upper()[0].latin1() - 'A' + 1;
388 tmp += fileName; 401 if ( _getdrive() != drv ) {
402 if ( qt_winunicode ) {
403 TCHAR buf[PATH_MAX];
404 ::_tgetdcwd( drv, buf, PATH_MAX );
405 tmp.setUnicodeCodes( (ushort*)buf, ::_tcslen(buf) );
406 } else {
407 char buf[PATH_MAX];
408 ::_getdcwd( drv, buf, PATH_MAX );
409 tmp = buf;
410 }
411 if ( !tmp.endsWith("\\") )
412 tmp += "\\";
413 tmp += fileName.right( fileName.length() - 2 );
414 int x;
415 for ( x = 0; x < (int) tmp.length(); x++ ) {
416 if ( tmp[x] == '\\' )
417 tmp[x] = '/';
418 }
419 }
420 } else
421#endif
422 {
423 if ( tmp.isEmpty() || (tmp[(int)tmp.length()-1] != '/' && !!fileName &&
424 fileName[0] != '/') )
425 tmp += '/';
426 tmp += fileName;
427 }
389 return tmp; 428 return tmp;
@@ -936,3 +975,4 @@ QDir &QDir::operator=( const QString &path )
936 QDir d2( "bin" ); 975 QDir d2( "bin" );
937 if ( d1 != d2 ) qDebug( "They differ\n" ); // This is printed 976 if ( d1 != d2 )
977 qDebug( "They differ" );
938 \endcode 978 \endcode
@@ -951,3 +991,4 @@ QDir &QDir::operator=( const QString &path )
951 d2.convertToAbs(); 991 d2.convertToAbs();
952 if ( d1 == d2 ) qDebug( "They're the same\n" ); // This is printed 992 if ( d1 == d2 )
993 qDebug( "They're the same" );
953 \endcode 994 \endcode
@@ -1089,6 +1130,7 @@ QDir QDir::root()
1089 1130
1090QStringList qt_makeFilterList( const QString &filter ) 1131QValueList<QRegExp> qt_makeFilterList( const QString &filter )
1091{ 1132{
1133 QValueList<QRegExp> regExps;
1092 if ( filter.isEmpty() ) 1134 if ( filter.isEmpty() )
1093 return QStringList(); 1135 return regExps;
1094 1136
@@ -1101,11 +1143,22 @@ QStringList qt_makeFilterList( const QString &filter )
1101 QStringList::Iterator it = list.begin(); 1143 QStringList::Iterator it = list.begin();
1102 QStringList list2; 1144 while ( it != list.end() ) {
1145 regExps << QRegExp( (*it).stripWhiteSpace(), CaseSensitiveFS, TRUE );
1146 ++it;
1147 }
1148 return regExps;
1149}
1103 1150
1104 for ( ; it != list.end(); ++it ) { 1151bool qt_matchFilterList( const QValueList<QRegExp>& filters,
1105 QString s = *it; 1152 const QString &fileName )
1106 list2 << s.stripWhiteSpace(); 1153{
1154 QValueList<QRegExp>::ConstIterator rit = filters.begin();
1155 while ( rit != filters.end() ) {
1156 if ( (*rit).exactMatch(fileName) )
1157 return TRUE;
1158 ++rit;
1107 } 1159 }
1108 return list2; 1160 return FALSE;
1109} 1161}
1110 1162
1163
1111/*! 1164/*!
@@ -1125,7 +1178,3 @@ bool QDir::match( const QStringList &filters, const QString &fileName )
1125 while ( sit != filters.end() ) { 1178 while ( sit != filters.end() ) {
1126#if defined(Q_FS_FAT) && !defined(Q_OS_UNIX) 1179 QRegExp rx( *sit, CaseSensitiveFS, TRUE );
1127 QRegExp rx( *sit, FALSE, TRUE ); // The FAT FS is not case sensitive..
1128#else
1129 QRegExp rx( *sit, TRUE, TRUE ); // ..while others are.
1130#endif
1131 if ( rx.exactMatch(fileName) ) 1180 if ( rx.exactMatch(fileName) )
@@ -1149,4 +1198,3 @@ bool QDir::match( const QString &filter, const QString &fileName )
1149{ 1198{
1150 QStringList lst = qt_makeFilterList( filter ); 1199 return qt_matchFilterList( qt_makeFilterList(filter), fileName );
1151 return match( lst, fileName );
1152} 1200}
diff --git a/qmake/tools/qdir_unix.cpp b/qmake/tools/qdir_unix.cpp
index 57fe3c5..6a7adda 100644
--- a/qmake/tools/qdir_unix.cpp
+++ b/qmake/tools/qdir_unix.cpp
@@ -7,3 +7,3 @@
7** 7**
8** Copyright (C) 1992-2002 Trolltech AS. All rights reserved. 8** Copyright (C) 1992-2003 Trolltech AS. All rights reserved.
9** 9**
@@ -53,2 +53,3 @@
53#include <limits.h> 53#include <limits.h>
54#include <errno.h>
54 55
@@ -72,13 +73,12 @@ QString QDir::canonicalPath() const
72 QString r; 73 QString r;
73
74 char cur[PATH_MAX+1]; 74 char cur[PATH_MAX+1];
75 if ( ::getcwd( cur, PATH_MAX ) ) 75 if ( ::getcwd( cur, PATH_MAX ) ) {
76 if ( ::chdir(QFile::encodeName(dPath)) >= 0 ) { 76 char tmp[PATH_MAX+1];
77 char tmp[PATH_MAX+1]; 77 if( ::realpath( QFile::encodeName( dPath ), tmp ) )
78 if ( ::getcwd( tmp, PATH_MAX ) ) 78 r = QFile::decodeName( tmp );
79 r = QFile::decodeName(tmp); 79 slashify( r );
80 ::chdir( cur ); 80
81 } 81 // always make sure we go back to the current dir
82 82 ::chdir( cur );
83 slashify( r ); 83 }
84 return r; 84 return r;
@@ -92,8 +92,9 @@ bool QDir::mkdir( const QString &dirName, bool acceptAbsPath ) const
92 name = dirName.left( dirName.length() - 1 ); 92 name = dirName.left( dirName.length() - 1 );
93 return ::mkdir( QFile::encodeName(filePath(name,acceptAbsPath)), 0777 ) 93 int status =
94 == 0; 94 ::mkdir( QFile::encodeName(filePath(name,acceptAbsPath)), 0777 );
95#else 95#else
96 return ::mkdir( QFile::encodeName(filePath(dirName,acceptAbsPath)), 0777 ) 96 int status =
97 == 0; 97 ::mkdir( QFile::encodeName(filePath(dirName,acceptAbsPath)), 0777 );
98#endif 98#endif
99 return status == 0;
99} 100}
@@ -188,3 +189,3 @@ bool QDir::readDirEntries( const QString &nameFilter,
188 189
189 QStringList filters = qt_makeFilterList( nameFilter ); 190 QValueList<QRegExp> filters = qt_makeFilterList( nameFilter );
190 191
@@ -199,7 +200,2 @@ bool QDir::readDirEntries( const QString &nameFilter,
199 200
200#if defined(Q_OS_OS2EMX)
201 //QRegExp wc( nameFilter, FALSE, TRUE );// wild card, case insensitive
202#else
203 //QRegExp wc( nameFilter, TRUE, TRUE );// wild card, case sensitive
204#endif
205 QFileInfo fi; 201 QFileInfo fi;
@@ -212,6 +208,15 @@ bool QDir::readDirEntries( const QString &nameFilter,
212 208
213 while ( (file = readdir(dir)) ) { 209#if defined(QT_THREAD_SUPPORT) && defined(_POSIX_THREAD_SAFE_FUNCTIONS) && !defined(Q_OS_CYGWIN)
210 union {
211 struct dirent mt_file;
212 char b[sizeof(struct dirent) + MAXNAMLEN + 1];
213 } u;
214 while ( readdir_r(dir, &u.mt_file, &file ) == 0 && file )
215#else
216 while ( (file = readdir(dir)) )
217#endif // QT_THREAD_SUPPORT && _POSIX_THREAD_SAFE_FUNCTIONS
218 {
214 QString fn = QFile::decodeName(file->d_name); 219 QString fn = QFile::decodeName(file->d_name);
215 fi.setFile( *this, fn ); 220 fi.setFile( *this, fn );
216 if ( !match( filters, fn ) && !(allDirs && fi.isDir()) ) 221 if ( !qt_matchFilterList(filters, fn) && !(allDirs && fi.isDir()) )
217 continue; 222 continue;
@@ -278,3 +283,4 @@ const QFileInfoList * QDir::drives()
278#ifdef QT_THREAD_SUPPORT 283#ifdef QT_THREAD_SUPPORT
279 QMutexLocker locker( qt_global_mutexpool->get( &knownMemoryLeak ) ); 284 QMutexLocker locker( qt_global_mutexpool ?
285 qt_global_mutexpool->get( &knownMemoryLeak ) : 0 );
280#endif // QT_THREAD_SUPPORT 286#endif // QT_THREAD_SUPPORT
diff --git a/qmake/tools/qfile.cpp b/qmake/tools/qfile.cpp
index a578b49..c088b55 100644
--- a/qmake/tools/qfile.cpp
+++ b/qmake/tools/qfile.cpp
@@ -90,3 +90,3 @@ extern bool qt_file_access( const QString& fn, int t );
90 int i = 1; 90 int i = 1;
91 while ( !stream.eof() ) { 91 while ( !stream.atEnd() ) {
92 line = stream.readLine(); // line of text excluding '\n' 92 line = stream.readLine(); // line of text excluding '\n'
@@ -292,2 +292,3 @@ void QFile::flush()
292 Returns TRUE if the end of file has been reached; otherwise returns FALSE. 292 Returns TRUE if the end of file has been reached; otherwise returns FALSE.
293 If QFile has not been open()'d, then the behavior is undefined.
293 294
diff --git a/qmake/tools/qfile_unix.cpp b/qmake/tools/qfile_unix.cpp
index 2d5a856..460bf06 100644
--- a/qmake/tools/qfile_unix.cpp
+++ b/qmake/tools/qfile_unix.cpp
@@ -437,7 +437,10 @@ QIODevice::Offset QFile::size() const
437 struct stat st; 437 struct stat st;
438 int ret = 0;
438 if ( isOpen() ) { 439 if ( isOpen() ) {
439 ::fstat( fh ? fileno(fh) : fd, &st ); 440 ret = ::fstat( fh ? fileno(fh) : fd, &st );
440 } else { 441 } else {
441 ::stat( QFile::encodeName(fn), &st ); 442 ret = ::stat( QFile::encodeName(fn), &st );
442 } 443 }
444 if ( ret == -1 )
445 return 0;
443#if defined(QT_LARGEFILE_SUPPORT) && !defined(QT_ABI_64BITOFFSET) 446#if defined(QT_LARGEFILE_SUPPORT) && !defined(QT_ABI_64BITOFFSET)
@@ -540,3 +543,3 @@ Q_LONG QFile::readBlock( char *p, Q_ULONG len )
540 while( nread < l ) { 543 while( nread < l ) {
541 *p = ungetchBuffer[ l - nread - 1 ]; 544 *p = ungetchBuffer.at( l - nread - 1 );
542 p++; 545 p++;
@@ -631,3 +634,5 @@ Q_LONG QFile::writeBlock( const char *p, Q_ULONG len )
631 This is a small positive integer, suitable for use with C library 634 This is a small positive integer, suitable for use with C library
632 functions such as fdopen() and fcntl(), as well as with QSocketNotifier. 635 functions such as fdopen() and fcntl(). On systems that use file
636 descriptors for sockets (ie. Unix systems, but not Windows) the handle
637 can be used with QSocketNotifier as well.
633 638
diff --git a/qmake/tools/qfileinfo.cpp b/qmake/tools/qfileinfo.cpp
index 3af7932..a78f4fa 100644
--- a/qmake/tools/qfileinfo.cpp
+++ b/qmake/tools/qfileinfo.cpp
@@ -637,2 +637,4 @@ QDateTime QFileInfo::lastRead() const
637 637
638 If the QFileInfo is empty it returns QDir::currentDirPath().
639
638 This function can be time consuming under Unix (in the order of 640 This function can be time consuming under Unix (in the order of
@@ -646,3 +648,3 @@ QString QFileInfo::absFilePath() const
646 if ( QDir::isRelativePath(fn) 648 if ( QDir::isRelativePath(fn)
647#if defined(Q_OS_WIN32) || defined(Q_OS_WIN64) 649#if defined(Q_OS_WIN32)
648 && fn[1] != ':' 650 && fn[1] != ':'
diff --git a/qmake/tools/qfileinfo_unix.cpp b/qmake/tools/qfileinfo_unix.cpp
index f7c3a97..364f219 100644
--- a/qmake/tools/qfileinfo_unix.cpp
+++ b/qmake/tools/qfileinfo_unix.cpp
@@ -216,5 +216,5 @@ uint QFileInfo::groupId() const
216 if ( fi.permission( QFileInfo::WriteUser | QFileInfo::ReadGroup ) ) 216 if ( fi.permission( QFileInfo::WriteUser | QFileInfo::ReadGroup ) )
217 qWarning( "I can change the file; my group can read the file."); 217 qWarning( "I can change the file; my group can read the file" );
218 if ( fi.permission( QFileInfo::WriteGroup | QFileInfo::WriteOther ) ) 218 if ( fi.permission( QFileInfo::WriteGroup | QFileInfo::WriteOther ) )
219 qWarning( "The group or others can change the file!" ); 219 qWarning( "The group or others can change the file" );
220 \endcode 220 \endcode
diff --git a/qmake/tools/qgarray.cpp b/qmake/tools/qgarray.cpp
index 45c45ce..0a522e4 100644
--- a/qmake/tools/qgarray.cpp
+++ b/qmake/tools/qgarray.cpp
@@ -37,5 +37,9 @@
37 37
38 #include "qglobal.h" // needed to define Q_WS_WIN 38#include "qglobal.h"
39#ifdef Q_WS_WIN 39#if defined(Q_CC_BOR)
40 #include "qt_windows.h" // needed for bsearch on some platforms 40 // needed for qsort() because of a std namespace problem on Borland
41# include "qplatformdefs.h"
42#elif defined(Q_WS_WIN)
43 // needed for bsearch on some platforms
44# include "qt_windows.h"
41#endif 45#endif
@@ -51,3 +55,9 @@
51 55
52 #define USE_MALLOC // comment to use new/delete 56/*
57 If USE_MALLOC isn't defined, we use new[] and delete[] to allocate
58 memory. The documentation for QMemArray<T>::assign() explicitly
59 mentions that the array is freed using free(), so don't mess around
60 with USE_MALLOC unless you know what you're doing.
61*/
62#define USE_MALLOC
53 63
@@ -137,3 +147,7 @@ QGArray::QGArray( int size )
137 Q_CHECK_PTR( shd->data ); 147 Q_CHECK_PTR( shd->data );
138 shd->len = size; 148 shd->len =
149#ifdef QT_QGARRAY_SPEED_OPTIM
150 shd->maxl =
151#endif
152 size;
139} 153}
@@ -214,8 +228,16 @@ bool QGArray::isEqual( const QGArray &a ) const
214/*! 228/*!
215 Resizes the array to \a newsize bytes. 229 Resizes the array to \a newsize bytes. \a optim is either
230 MemOptim (the default) or SpeedOptim.
216*/ 231*/
217 232bool QGArray::resize( uint newsize, Optimization optim )
218bool QGArray::resize( uint newsize )
219{ 233{
220 if ( newsize == shd->len ) // nothing to do 234#ifndef QT_QGARRAY_SPEED_OPTIM
235 Q_UNUSED(optim);
236#endif
237
238 if ( newsize == shd->len
239#ifdef QT_QGARRAY_SPEED_OPTIM
240 && newsize == shd->maxl
241#endif
242 ) // nothing to do
221 return TRUE; 243 return TRUE;
@@ -225,2 +247,21 @@ bool QGArray::resize( uint newsize )
225 } 247 }
248
249 uint newmaxl = newsize;
250#ifdef QT_QGARRAY_SPEED_OPTIM
251 if ( optim == SpeedOptim ) {
252 if ( newsize <= shd->maxl &&
253 ( newsize * 4 > shd->maxl || shd->maxl <= 4 ) ) {
254 shd->len = newsize;
255 return TRUE;
256 }
257 newmaxl = 4;
258 while ( newmaxl < newsize )
259 newmaxl *= 2;
260 // try to spare some memory
261 if ( newmaxl >= 1024 * 1024 && newsize <= newmaxl - (newmaxl >> 2) )
262 newmaxl -= newmaxl >> 2;
263 }
264 shd->maxl = newmaxl;
265#endif
266
226 if ( shd->data ) { // existing data 267 if ( shd->data ) { // existing data
@@ -228,3 +269,3 @@ bool QGArray::resize( uint newsize )
228 char *newdata = NEW(char,newsize);// manual realloc 269 char *newdata = NEW(char,newsize);// manual realloc
229 memcpy( newdata, shd->data, QMIN(shd->len,newsize) ); 270 memcpy( newdata, shd->data, QMIN(shd->len,newmaxl) );
230 DELETE(shd->data); 271 DELETE(shd->data);
@@ -232,6 +273,6 @@ bool QGArray::resize( uint newsize )
232#else 273#else
233 shd->data = (char *)realloc( shd->data, newsize ); 274 shd->data = (char *)realloc( shd->data, newmaxl );
234#endif 275#endif
235 } else { 276 } else {
236 shd->data = NEW(char,newsize); 277 shd->data = NEW(char,newmaxl);
237 } 278 }
@@ -243,2 +284,10 @@ bool QGArray::resize( uint newsize )
243 284
285/*!\overload
286*/
287bool QGArray::resize( uint newsize )
288{
289 return resize( newsize, MemOptim );
290}
291
292
244/*! 293/*!
@@ -321,3 +370,7 @@ QGArray &QGArray::assign( const char *d, uint len )
321 shd->data = (char *)d; 370 shd->data = (char *)d;
322 shd->len = len; 371 shd->len =
372#ifdef QT_QGARRAY_SPEED_OPTIM
373 shd->maxl =
374#endif
375 len;
323 return *this; 376 return *this;
@@ -366,3 +419,7 @@ QGArray &QGArray::duplicate( const QGArray &a )
366 } 419 }
367 shd->len = a.shd->len; 420 shd->len =
421#ifdef QT_QGARRAY_SPEED_OPTIM
422 shd->maxl =
423#endif
424 a.shd->len;
368 if ( oldptr ) 425 if ( oldptr )
@@ -404,3 +461,7 @@ QGArray &QGArray::duplicate( const char *d, uint len )
404 shd->data = data; 461 shd->data = data;
405 shd->len = len; 462 shd->len =
463#ifdef QT_QGARRAY_SPEED_OPTIM
464 shd->maxl =
465#endif
466 len;
406 return *this; 467 return *this;
@@ -661,3 +722,4 @@ void QGArray::sort( uint sz )
661#ifdef QT_THREAD_SUPPORT 722#ifdef QT_THREAD_SUPPORT
662 QMutexLocker locker( qt_global_mutexpool->get( &cmp_item_size ) ); 723 QMutexLocker locker( qt_global_mutexpool ?
724 qt_global_mutexpool->get( &cmp_item_size ) : 0 );
663#endif // QT_THREAD_SUPPORT 725#endif // QT_THREAD_SUPPORT
@@ -679,3 +741,4 @@ int QGArray::bsearch( const char *d, uint sz ) const
679#ifdef QT_THREAD_SUPPORT 741#ifdef QT_THREAD_SUPPORT
680 QMutexLocker locker( qt_global_mutexpool->get( &cmp_item_size ) ); 742 QMutexLocker locker( qt_global_mutexpool ?
743 qt_global_mutexpool->get( &cmp_item_size ) : 0 );
681#endif // QT_THREAD_SUPPORT 744#endif // QT_THREAD_SUPPORT
diff --git a/qmake/tools/qgdict.cpp b/qmake/tools/qgdict.cpp
index c431ff8..3d49fc7 100644
--- a/qmake/tools/qgdict.cpp
+++ b/qmake/tools/qgdict.cpp
@@ -206,3 +206,6 @@ void QGDict::init( uint len, KeyType kt, bool caseSensitive, bool copyKeys )
206{ 206{
207 vec = new QBaseBucket *[vlen = len]; // allocate hash table 207 vlen = len;
208 if ( vlen == 0 )
209 vlen = 17;
210 vec = new QBaseBucket *[vlen];
208 Q_CHECK_PTR( vec ); 211 Q_CHECK_PTR( vec );
diff --git a/qmake/tools/qglist.cpp b/qmake/tools/qglist.cpp
index 155d585..bd27f8a 100644
--- a/qmake/tools/qglist.cpp
+++ b/qmake/tools/qglist.cpp
@@ -331,8 +331,4 @@ QLNode *QGList::locate( uint index )
331 331
332 if ( index >= numNodes ) { 332 if ( index >= numNodes )
333#if defined(QT_CHECK_RANGE)
334 qWarning( "QGList::locate: Index %d out of range", index );
335#endif
336 return 0; 333 return 0;
337 }
338 334
diff --git a/qmake/tools/qglobal.cpp b/qmake/tools/qglobal.cpp
index 47cd6bd..342005d 100644
--- a/qmake/tools/qglobal.cpp
+++ b/qmake/tools/qglobal.cpp
@@ -151,3 +151,24 @@ bool qSysInfo( int *wordSize, bool *bigEndian )
151 151
152#if defined(Q_OS_WIN32) || defined(Q_OS_CYGWIN) 152#if !defined(QWS) && defined(Q_OS_MAC)
153
154#include "qt_mac.h"
155
156int qMacVersion()
157{
158 static int macver = Qt::MV_Unknown;
159 static bool first = TRUE;
160 if(first) {
161 first = FALSE;
162 long gestalt_version;
163 if(Gestalt(gestaltSystemVersion, &gestalt_version) == noErr) {
164 if(gestalt_version >= 0x1020 && gestalt_version < 0x1030)
165 macver = Qt::MV_10_DOT_2;
166 else if(gestalt_version >= 0x1010 && gestalt_version < 0x1020)
167 macver = Qt::MV_10_DOT_1;
168 }
169 }
170 return macver;
171}
172Qt::MacintoshVersion qt_macver = (Qt::MacintoshVersion)qMacVersion();
173#elif defined(Q_OS_WIN32) || defined(Q_OS_CYGWIN)
153bool qt_winunicode; 174bool qt_winunicode;
@@ -323,3 +344,15 @@ static const int QT_BUFFER_LENGTH = 8196; // internal buffer length
323#ifdef Q_OS_MAC 344#ifdef Q_OS_MAC
324const unsigned char * p_str(const char * c, int len=-1) 345QString cfstring2qstring(CFStringRef str)
346{
347 CFIndex length = CFStringGetLength(str);
348 if(const UniChar *chars = CFStringGetCharactersPtr(str))
349 return QString((QChar *)chars, length);
350 UniChar *buffer = (UniChar*)malloc(length * sizeof(UniChar));
351 CFStringGetCharacters(str, CFRangeMake(0, length), buffer);
352 QString ret((QChar *)buffer, length);
353 free(buffer);
354 return ret;
355}
356
357unsigned char * p_str(const char * c, int len=-1)
325{ 358{
@@ -339,3 +372,3 @@ const unsigned char * p_str(const char * c, int len=-1)
339 372
340const unsigned char * p_str(const QString &s) 373unsigned char * p_str(const QString &s)
341{ 374{
@@ -643,4 +676,4 @@ void qSystemWarning( const char* msg, int code )
643 676
644 If \a p is null, a fatal messages says that the program ran out of 677 If \a p is 0, a fatal messages says that the program ran out of
645 memory and exits. If \e p is not null, nothing happens. 678 memory and exits. If \e p is not 0, nothing happens.
646 679
@@ -654,3 +687,3 @@ void qSystemWarning( const char* msg, int code )
654 687
655 a = new int[80]; // Right 688 a = new (nothrow) int[80]; // Right
656 Q_CHECK_PTR( a ); 689 Q_CHECK_PTR( a );
diff --git a/qmake/tools/qgpluginmanager.cpp b/qmake/tools/qgpluginmanager.cpp
index 46c85f5..72246ac 100644
--- a/qmake/tools/qgpluginmanager.cpp
+++ b/qmake/tools/qgpluginmanager.cpp
@@ -5,3 +5,3 @@
5** 5**
6** Copyright (C) 2000-2001 Trolltech AS. All rights reserved. 6** Copyright (C) 2000-2003 Trolltech AS. All rights reserved.
7** 7**
@@ -477,3 +477,3 @@ bool QGPluginManager::addLibrary( QLibrary* lib )
477 477
478 for ( QStringList::Iterator f = fl.begin(); f != fl.end(); f++ ) { 478 for ( QStringList::Iterator f = fl.begin(); f != fl.end(); ++f ) {
479 QLibrary *old = plugDict[*f]; 479 QLibrary *old = plugDict[*f];
diff --git a/qmake/tools/qgvector.cpp b/qmake/tools/qgvector.cpp
index 1985f03..3c903ed 100644
--- a/qmake/tools/qgvector.cpp
+++ b/qmake/tools/qgvector.cpp
@@ -37,2 +37,8 @@
37 37
38#include "qglobal.h"
39#if defined(Q_CC_BOR)
40// needed for qsort() because of a std namespace problem on Borland
41#include "qplatformdefs.h"
42#endif
43
38 #define QGVECTOR_CPP 44 #define QGVECTOR_CPP
@@ -395,3 +401,4 @@ void QGVector::sort() // sort vector
395#ifdef QT_THREAD_SUPPORT 401#ifdef QT_THREAD_SUPPORT
396 QMutexLocker locker( qt_global_mutexpool->get( &sort_vec ) ); 402 QMutexLocker locker( qt_global_mutexpool ?
403 qt_global_mutexpool->get( &sort_vec ) : 0 );
397#endif // QT_THREAD_SUPPORT 404#endif // QT_THREAD_SUPPORT
diff --git a/qmake/tools/qlibrary.cpp b/qmake/tools/qlibrary.cpp
index 564db30..be1d54b 100644
--- a/qmake/tools/qlibrary.cpp
+++ b/qmake/tools/qlibrary.cpp
@@ -5,5 +5,5 @@
5** 5**
6** Created : 2000-01-01 6** Created : 000101
7** 7**
8** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. 8** Copyright (C) 2000-2003 Trolltech AS. All rights reserved.
9** 9**
@@ -73,3 +73,3 @@ QLibraryPrivate::QLibraryPrivate( QLibrary *lib )
73 \mainclass 73 \mainclass
74 \group plugins 74 \ingroup plugins
75 75
@@ -328,3 +328,4 @@ QString QLibrary::library() const
328#else 328#else
329 if ( filename.find( ".so" ) == -1 ) { 329 QString filter = ".so";
330 if ( filename.find(filter) == -1 ) {
330 const int x = filename.findRev( "/" ); 331 const int x = filename.findRev( "/" );
@@ -333,5 +334,5 @@ QString QLibrary::library() const
333 QString file = filename.right( filename.length() - x - 1 ); 334 QString file = filename.right( filename.length() - x - 1 );
334 filename = QString( "%1lib%2.so" ).arg( path ).arg( file ); 335 filename = QString( "%1lib%2.%3" ).arg( path ).arg( file ).arg( filter );
335 } else { 336 } else {
336 filename = QString( "lib%1.so" ).arg( filename ); 337 filename = QString( "lib%1.%2" ).arg( filename ).arg( filter );
337 } 338 }
diff --git a/qmake/tools/qlibrary_unix.cpp b/qmake/tools/qlibrary_unix.cpp
index f0fbdf6..12b9310 100644
--- a/qmake/tools/qlibrary_unix.cpp
+++ b/qmake/tools/qlibrary_unix.cpp
@@ -5,3 +5,3 @@
5** 5**
6** Created : 2000-01-01 6** Created : 000101
7** 7**
@@ -55,3 +55,20 @@
55 55
56#if defined(QT_HPUX_LD) // for HP-UX < 11.x and 32 bit 56#if defined(Q_OS_MAC)
57
58bool QLibraryPrivate::loadLibrary()
59{
60 return FALSE;
61}
62
63bool QLibraryPrivate::freeLibrary()
64{
65 return FALSE;
66}
67
68void* QLibraryPrivate::resolveSymbol( const char* )
69{
70 return 0;
71}
72
73#elif defined(QT_HPUX_LD) // for HP-UX < 11.x and 32 bit
57 74
diff --git a/qmake/tools/qmutex_unix.cpp b/qmake/tools/qmutex_unix.cpp
index c861b2d..3eb59cf 100644
--- a/qmake/tools/qmutex_unix.cpp
+++ b/qmake/tools/qmutex_unix.cpp
@@ -45,4 +45,5 @@ typedef pthread_mutex_t Q_MUTEX_T;
45#if ((defined(PTHREAD_MUTEX_RECURSIVE) && defined(PTHREAD_MUTEX_DEFAULT)) || \ 45#if ((defined(PTHREAD_MUTEX_RECURSIVE) && defined(PTHREAD_MUTEX_DEFAULT)) || \
46 defined(Q_OS_FREEBSD)) && !defined(Q_OS_UNIXWARE) && !defined(Q_OS_SOLARIS) 46 defined(Q_OS_FREEBSD)) && !defined(Q_OS_UNIXWARE) && !defined(Q_OS_SOLARIS) && \
47 // POSIX 1003.1c-1995 - We love this OS 47 !defined(Q_OS_MAC)
48// POSIX 1003.1c-1995 - We love this OS
48# define Q_MUTEX_SET_TYPE(a, b) pthread_mutexattr_settype((a), (b)) 49# define Q_MUTEX_SET_TYPE(a, b) pthread_mutexattr_settype((a), (b))
@@ -663,3 +664,4 @@ bool QMutex::tryLock()
663 Constructs a QMutexLocker and locks \a mutex. The mutex will be 664 Constructs a QMutexLocker and locks \a mutex. The mutex will be
664 unlocked when the QMutexLocker is destroyed. 665 unlocked when the QMutexLocker is destroyed. If \a mutex is zero,
666 QMutexLocker does nothing.
665 667
diff --git a/qmake/tools/qmutexpool.cpp b/qmake/tools/qmutexpool.cpp
index 9ed2829..a8e7402 100644
--- a/qmake/tools/qmutexpool.cpp
+++ b/qmake/tools/qmutexpool.cpp
@@ -1 +1,36 @@
1/****************************************************************************
2** $Id$
3**
4** ...
5**
6** Copyright (C) 2002 Trolltech AS. All rights reserved.
7**
8** This file is part of the tools module of the Qt GUI Toolkit.
9**
10** This file may be distributed under the terms of the Q Public License
11** as defined by Trolltech AS of Norway and appearing in the file
12** LICENSE.QPL included in the packaging of this file.
13**
14** This file may be distributed and/or modified under the terms of the
15** GNU General Public License version 2 as published by the Free Software
16** Foundation and appearing in the file LICENSE.GPL included in the
17** packaging of this file.
18**
19** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
20** licenses may use this file in accordance with the Qt Commercial License
21** Agreement provided with the Software.
22**
23** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
24** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
25**
26** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
27** information about Qt Commercial License Agreements.
28** See http://www.trolltech.com/qpl/ for QPL licensing information.
29** See http://www.trolltech.com/gpl/ for GPL licensing information.
30**
31** Contact info@trolltech.com if any conditions of this licensing are
32** not clear to you.
33**
34**********************************************************************/
35
1#include "qmutexpool_p.h" 36#include "qmutexpool_p.h"
@@ -5,3 +40,2 @@
5#include <qthread.h> 40#include <qthread.h>
6#include <stdio.h>
7 41
@@ -9,17 +43,2 @@ QMutexPool *qt_global_mutexpool = 0;
9 43
10// this is an internal class used only for inititalizing the global mutexpool
11class QGlobalMutexPoolInitializer
12{
13public:
14 inline QGlobalMutexPoolInitializer()
15 {
16 /*
17 Purify will report a leak here. However, this mutex pool must be alive
18 until *everything* in Qt has been destructed. Unfortunately there is
19 no way to guarantee this, so we never destroy this mutex pool.
20 */
21 qt_global_mutexpool = new QMutexPool( TRUE );
22 }
23};
24QGlobalMutexPoolInitializer qt_global_mutexpool_initializer;
25 44
@@ -87,5 +106,8 @@ QGlobalMutexPoolInitializer qt_global_mutexpool_initializer;
87QMutexPool::QMutexPool( bool recursive, int size ) 106QMutexPool::QMutexPool( bool recursive, int size )
88 : mutex( FALSE ), mutexes( size ), recurs( recursive ) 107 : mutex( FALSE ), count( size ), recurs( recursive )
89{ 108{
90 mutexes.fill( 0 ); 109 mutexes = new QMutex*[count];
110 for ( int index = 0; index < count; ++index ) {
111 mutexes[index] = 0;
112 }
91} 113}
@@ -99,7 +121,8 @@ QMutexPool::~QMutexPool()
99 QMutexLocker locker( &mutex ); 121 QMutexLocker locker( &mutex );
100 QMutex **d = mutexes.data(); 122 for ( int index = 0; index < count; ++index ) {
101 for ( int index = 0; (uint) index < mutexes.size(); index++ ) { 123 delete mutexes[index];
102 delete d[index]; 124 mutexes[index] = 0;
103 d[index] = 0;
104 } 125 }
126 delete [] mutexes;
127 mutexes = 0;
105} 128}
@@ -112,6 +135,5 @@ QMutex *QMutexPool::get( void *address )
112{ 135{
113 QMutex **d = mutexes.data(); 136 int index = (int) ( (unsigned long) address % count );
114 int index = (int)( (ulong) address % mutexes.size() );
115 137
116 if ( ! d[index] ) { 138 if ( ! mutexes[index] ) {
117 // mutex not created, create one 139 // mutex not created, create one
@@ -121,4 +143,4 @@ QMutex *QMutexPool::get( void *address )
121 // 2 threads could be trying to create a mutex as the same index... 143 // 2 threads could be trying to create a mutex as the same index...
122 if ( ! d[index] ) { 144 if ( ! mutexes[index] ) {
123 d[index] = new QMutex( recurs ); 145 mutexes[index] = new QMutex( recurs );
124 } 146 }
@@ -126,3 +148,3 @@ QMutex *QMutexPool::get( void *address )
126 148
127 return d[index]; 149 return mutexes[index];
128} 150}
diff --git a/qmake/tools/qregexp.cpp b/qmake/tools/qregexp.cpp
index 500efed..0c1f060 100644
--- a/qmake/tools/qregexp.cpp
+++ b/qmake/tools/qregexp.cpp
@@ -265,3 +265,3 @@
265 \row \i <b>\\d</b> 265 \row \i <b>\\d</b>
266 \i This matches a digit (see QChar::isDigit()). 266 \i This matches a digit (QChar::isDigit()).
267 \row \i <b>\\D</b> 267 \row \i <b>\\D</b>
@@ -269,3 +269,3 @@
269 \row \i <b>\\s</b> 269 \row \i <b>\\s</b>
270 \i This matches a whitespace (see QChar::isSpace()). 270 \i This matches a whitespace (QChar::isSpace()).
271 \row \i <b>\\S</b> 271 \row \i <b>\\S</b>
@@ -273,3 +273,3 @@
273 \row \i <b>\\w</b> 273 \row \i <b>\\w</b>
274 \i This matches a word character (see QChar::isLetterOrNumber()). 274 \i This matches a word character (QChar::isLetterOrNumber() or '_').
275 \row \i <b>\\W</b> 275 \row \i <b>\\W</b>
@@ -549,3 +549,10 @@
549 Perl's extended \c{/x} syntax is not supported, nor are 549 Perl's extended \c{/x} syntax is not supported, nor are
550 regexp comments (?#comment) or directives, e.g. (?i). 550 directives, e.g. (?i), or regexp comments, e.g. (?#comment). On
551 the other hand, C++'s rules for literal strings can be used to
552 achieve the same:
553 \code
554 QRegExp mark( "\\b" // word boundary
555 "[Mm]ark" // the word we want to match
556 );
557 \endcode
551 558
@@ -679,7 +686,7 @@
679 \code 686 \code
680 QRegExp rx( "*.html" ); // invalid regexp: * doesn't quantify anything 687 QRegExp rx( "*.html" ); // invalid regexp: * doesn't quantify anything
681 rx.setWildcard( TRUE ); // now it's a valid wildcard regexp 688 rx.setWildcard( TRUE ); // now it's a valid wildcard regexp
682 rx.search( "index.html" ); // returns 0 (matched at position 0) 689 rx.exactMatch( "index.html" ); // returns TRUE
683 rx.search( "default.htm" ); // returns -1 (no match) 690 rx.exactMatch( "default.htm" ); // returns FALSE
684 rx.search( "readme.txt" ); // returns -1 (no match) 691 rx.exactMatch( "readme.txt" ); // returns FALSE
685 \endcode 692 \endcode
@@ -717,2 +724,7 @@ const int EOS = -1;
717 724
725static bool isWord( QChar ch )
726{
727 return ch.isLetterOrNumber() || ch == QChar( '_' );
728}
729
718/* 730/*
@@ -1682,5 +1694,5 @@ bool QRegExpEngine::testAnchor( int i, int a, const int *capBegin )
1682 if ( mmPos + i != 0 ) 1694 if ( mmPos + i != 0 )
1683 before = mmIn[mmPos + i - 1].isLetterOrNumber(); 1695 before = isWord( mmIn[mmPos + i - 1] );
1684 if ( mmPos + i != mmLen ) 1696 if ( mmPos + i != mmLen )
1685 after = mmIn[mmPos + i].isLetterOrNumber(); 1697 after = isWord( mmIn[mmPos + i] );
1686 if ( (a & Anchor_Word) != 0 && (before == after) ) 1698 if ( (a & Anchor_Word) != 0 && (before == after) )
@@ -2634,3 +2646,10 @@ int QRegExpEngine::getEscape()
2634 // see QChar::isLetterOrNumber() 2646 // see QChar::isLetterOrNumber()
2635 yyCharClass->addCategories( 0x7ff07f8f ); 2647 yyCharClass->addCategories( 0x7fe07f8f );
2648 yyCharClass->addRange( 0x203f, 0x2040 );
2649 yyCharClass->addSingleton( 0x2040 );
2650 yyCharClass->addSingleton( 0x30fb );
2651 yyCharClass->addRange( 0xfe33, 0xfe34 );
2652 yyCharClass->addRange( 0xfe4d, 0xfe4f );
2653 yyCharClass->addSingleton( 0xff3f );
2654 yyCharClass->addSingleton( 0xff65 );
2636 return Tok_CharClass; 2655 return Tok_CharClass;
@@ -2654,2 +2673,3 @@ int QRegExpEngine::getEscape()
2654 yyCharClass->addCategories( 0x000f8070 ); 2673 yyCharClass->addCategories( 0x000f8070 );
2674 yyCharClass->addSingleton( 0x005f ); // '_'
2655 return Tok_CharClass; 2675 return Tok_CharClass;
@@ -3185,3 +3205,4 @@ static QRegExpEngine *newEngine( const QString& pattern, bool caseSensitive )
3185#ifdef QT_THREAD_SUPPORT 3205#ifdef QT_THREAD_SUPPORT
3186 QMutexLocker locker( qt_global_mutexpool->get( &engineCache ) ); 3206 QMutexLocker locker( qt_global_mutexpool ?
3207 qt_global_mutexpool->get( &engineCache ) : 0 );
3187#endif 3208#endif
@@ -3201,7 +3222,8 @@ static void derefEngine( QRegExpEngine *eng, const QString& pattern )
3201{ 3222{
3202 if ( eng != 0 && eng->deref() ) {
3203#ifndef QT_NO_REGEXP_OPTIM
3204#ifdef QT_THREAD_SUPPORT 3223#ifdef QT_THREAD_SUPPORT
3205 QMutexLocker locker( qt_global_mutexpool->get( &engineCache ) ); 3224 QMutexLocker locker( qt_global_mutexpool ?
3225 qt_global_mutexpool->get( &engineCache ) : 0 );
3206#endif 3226#endif
3227 if ( eng != 0 && eng->deref() ) {
3228#ifndef QT_NO_REGEXP_OPTIM
3207 if ( engineCache == 0 ) { 3229 if ( engineCache == 0 ) {
@@ -3567,9 +3589,2 @@ int QRegExp::match( const QString& str, int index, int *len,
3567 3589
3568/*!
3569 \overload
3570
3571 This convenience function searches with a \c CaretMode of \c
3572 CaretAtZero which is the most common usage.
3573*/
3574
3575int QRegExp::search( const QString& str, int offset ) const 3590int QRegExp::search( const QString& str, int offset ) const
@@ -3627,9 +3642,2 @@ int QRegExp::search( const QString& str, int offset, CaretMode caretMode ) const
3627 3642
3628/*!
3629 \overload
3630
3631 This convenience function searches with a \c CaretMode of \c
3632 CaretAtZero which is the most common usage.
3633*/
3634
3635int QRegExp::searchRev( const QString& str, int offset ) const 3643int QRegExp::searchRev( const QString& str, int offset ) const
@@ -3696,3 +3704,3 @@ int QRegExp::matchedLength() const
3696#ifndef QT_NO_REGEXP_CAPTURE 3704#ifndef QT_NO_REGEXP_CAPTURE
3697/*! 3705/*!
3698 Returns the number of captures contained in the regular expression. 3706 Returns the number of captures contained in the regular expression.
diff --git a/qmake/tools/qsemaphore_unix.cpp b/qmake/tools/qsemaphore_unix.cpp
index fcf28da..4516049 100644
--- a/qmake/tools/qsemaphore_unix.cpp
+++ b/qmake/tools/qsemaphore_unix.cpp
@@ -185,2 +185,9 @@ int QSemaphore::operator+=(int n)
185 185
186 if ( n < 0 || n > d->max ) {
187#ifdef QT_CHECK_RANGE
188 qWarning( "QSemaphore::operator+=: paramter %d out of range", n );
189#endif // QT_CHECK_RANGE
190 n = n < 0 ? 0 : d->max;
191 }
192
186 while (d->value + n > d->max) 193 while (d->value + n > d->max)
@@ -189,10 +196,2 @@ int QSemaphore::operator+=(int n)
189 d->value += n; 196 d->value += n;
190
191#ifdef QT_CHECK_RANGE
192 if (d->value > d->max) {
193 qWarning("QSemaphore::operator+=: attempt to allocate more resources than available");
194 d->value = d->max;
195 }
196#endif
197
198 ret = d->value; 197 ret = d->value;
@@ -214,11 +213,10 @@ int QSemaphore::operator-=(int n)
214 213
215 d->value -= n; 214 if ( n < 0 || n > d->value ) {
216
217#ifdef QT_CHECK_RANGE 215#ifdef QT_CHECK_RANGE
218 if (d->value < 0) { 216 qWarning( "QSemaphore::operator-=: paramter %d out of range", n );
219 qWarning("QSemaphore::operator-=: attempt to deallocate more resources than taken"); 217#endif // QT_CHECK_RANGE
220 d->value = 0; 218 n = n < 0 ? 0 : d->value;
221 } 219 }
222#endif
223 220
221 d->value -= n;
224 ret = d->value; 222 ret = d->value;
diff --git a/qmake/tools/qsettings.cpp b/qmake/tools/qsettings.cpp
index 5de105c..35fc039 100644
--- a/qmake/tools/qsettings.cpp
+++ b/qmake/tools/qsettings.cpp
@@ -5,3 +5,3 @@
5** 5**
6** Created: 2000.06.26 6** Created : 000626
7** 7**
@@ -65,25 +65,25 @@ static inline int qt_open( const char *pathname, int flags, mode_t mode )
65/*! 65/*!
66 \class QSettings 66 \class QSettings
67 \brief The QSettings class provides persistent platform-independent application settings. 67 \brief The QSettings class provides persistent platform-independent application settings.
68 68
69 \ingroup io 69 \ingroup io
70 \ingroup misc 70 \ingroup misc
71 \mainclass 71 \mainclass
72 72
73 On Unix systems, QSettings uses text files to store settings. On Windows 73 On Unix systems, QSettings uses text files to store settings. On Windows
74 systems, QSettings uses the system registry. On Mac OS X, QSettings will 74 systems, QSettings uses the system registry. On Mac OS X, QSettings uses
75 behave as on Unix, and store to text files. 75 the Carbon preferences API.
76 76
77 Each setting comprises an identifying key and the data associated with 77 Each setting comprises an identifying key and the data associated with
78 the key. A key is a unicode string which consists of \e two or more 78 the key. A key is a unicode string which consists of \e two or more
79 subkeys. A subkey is a slash, '/', followed by one or more unicode 79 subkeys. A subkey is a slash, '/', followed by one or more unicode
80 characters (excluding slashes, newlines, carriage returns and equals, 80 characters (excluding slashes, newlines, carriage returns and equals,
81 '=', signs). The associated data, called the entry or value, may be a 81 '=', signs). The associated data, called the entry or value, may be a
82 boolean, an integer, a double, a string or a list of strings. Entry 82 boolean, an integer, a double, a string or a list of strings. Entry
83 strings may contain any unicode characters. 83 strings may contain any unicode characters.
84 84
85 If you want to save and restore the entire desktop's settings, i.e. 85 If you want to save and restore the entire desktop's settings, i.e.
86 which applications are running, use QSettings to save the settings 86 which applications are running, use QSettings to save the settings
87 for each individual application and QSessionManager to save the 87 for each individual application and QSessionManager to save the
88 desktop's session. 88 desktop's session.
89 89
@@ -103,10 +103,9 @@ static inline int qt_open( const char *pathname, int flags, mode_t mode )
103 103
104 A typical usage pattern for application startup: 104 A typical usage pattern for reading application startup:
105 \code 105 \code
106 QSettings settings; 106 QSettings settings;
107 settings.insertSearchPath( QSettings::Windows, "/MyCompany" ); 107 settings.setPath( "MyCompany.com", "MyApplication" );
108 // No search path needed for Unix; see notes further on. 108
109 // Use default values if the keys don't exist 109 QString bgColor = settings.readEntry( "/colors/background", "white" );
110 QString bgColor = settings.readEntry( "/MyApplication/background color", "white" ); 110 int width = settings.readNumEntry( "/geometry/width", 640 );
111 int width = settings.readNumEntry( "/MyApplication/geometry/width", 640 );
112 // ... 111 // ...
@@ -117,6 +116,6 @@ static inline int qt_open( const char *pathname, int flags, mode_t mode )
117 QSettings settings; 116 QSettings settings;
118 settings.insertSearchPath( QSettings::Windows, "/MyCompany" ); 117 settings.setPath( "MyCompany.com", "MyApplication" );
119 // No search path needed for Unix; see notes further on. 118
120 settings.writeEntry( "/MyApplication/background color", bgColor ); 119 settings.writeEntry( "/colors/background", bgColor );
121 settings.writeEntry( "/MyApplication/geometry/width", width ); 120 settings.writeEntry( "/geometry/width", width );
122 // ... 121 // ...
@@ -124,2 +123,18 @@ static inline int qt_open( const char *pathname, int flags, mode_t mode )
124 123
124 QSettings can build a key prefix that is prepended to all keys. To
125 build the key prefix, use beginGroup() and endGroup().
126 \code
127 QSettings settings;
128
129 settings.beginGroup( "/MainWindow" );
130 settings.beginGroup( "/Geometry" );
131 int x = settings.readEntry( "/x" );
132 // ...
133 settings.endGroup();
134 settings.beginGroup( "/Toolbars" );
135 // ...
136 settings.endGroup();
137 settings.endGroup();
138 \endcode
139
125 You can get a list of entry-holding keys by calling entryList(), and 140 You can get a list of entry-holding keys by calling entryList(), and
@@ -141,6 +156,2 @@ static inline int qt_open( const char *pathname, int flags, mode_t mode )
141 156
142 If you wish to use a different search path call insertSearchPath()
143 as often as necessary to add your preferred paths. Call
144 removeSearchPath() to remove any unwanted paths.
145
146 Since settings for Windows are stored in the registry there are size 157 Since settings for Windows are stored in the registry there are size
@@ -154,3 +165,21 @@ static inline int qt_open( const char *pathname, int flags, mode_t mode )
154 165
155 These limitations are not enforced on Unix. 166 These limitations are not enforced on Unix or Mac OS X.
167
168 If you wish to use a different search path call insertSearchPath()
169 as often as necessary to add your preferred paths. Call
170 removeSearchPath() to remove any unwanted paths.
171
172 \section1 Notes for Mac OS X Applications
173
174 Internal to the CFPreferences API it is not defined (for Mac OS 9
175 support) where the settings will ultimitely be stored. However, at the
176 time of this writing the settings will be stored (either on a global or
177 user basis, preferring locally) into a plist file in
178 $ROOT/System/Library/Preferences (in XML format). QSettings will create
179 an appropriate plist file (com.<first group name>.plist) out of the
180 full path to a key.
181
182 For further information on CFPreferences see also
183 \link http://developer.apple.com/techpubs/macosx/CoreFoundation/PreferenceServices/preferenceservices_carbon.html
184 Apple's Specifications\endlink
156 185
@@ -302,3 +331,3 @@ static HANDLE openlock( const QString &name, int /*type*/ )
302 331
303 if ( !LockFile( fd, 0, 0, -1, -1 ) ) { 332 if ( !LockFile( fd, 0, 0, (DWORD)-1, (DWORD)-1 ) ) { // ### (DWORD)-1 ???
304#ifdef QT_CHECK_STATE 333#ifdef QT_CHECK_STATE
@@ -310,3 +339,3 @@ static HANDLE openlock( const QString &name, int /*type*/ )
310 339
311void closelock( HANDLE fd ) 340static void closelock( HANDLE fd )
312{ 341{
@@ -315,3 +344,3 @@ void closelock( HANDLE fd )
315 344
316 if ( !UnlockFile( fd, 0, 0, -1, -1 ) ) { 345 if ( !UnlockFile( fd, 0, 0, (DWORD)-1, (DWORD)-1 ) ) { // ### (DWORD)-1 ???
317#ifdef QT_CHECK_STATE 346#ifdef QT_CHECK_STATE
@@ -457,5 +486,7 @@ QSettingsPrivate::QSettingsPrivate( QSettings::Format format )
457{ 486{
458#if defined(Q_WS_WIN) || defined(Q_OS_MAC) 487#if !defined(QWS) && (defined(Q_WS_WIN) || defined(Q_OS_MAC))
459 if ( format != QSettings::Ini ) 488 if ( format != QSettings::Ini )
460 return; 489 return;
490#else
491 Q_UNUSED( format );
461#endif 492#endif
@@ -508,2 +539,4 @@ QSettingsPrivate::QSettingsPrivate( QSettings::Format format )
508 qWarning("QSettings: error creating %s", dir.path().latin1()); 539 qWarning("QSettings: error creating %s", dir.path().latin1());
540#else
541 ;
509#endif 542#endif
@@ -532,2 +565,4 @@ QSettingsGroup QSettingsPrivate::readGroup()
532 QStringList::Iterator it = searchPaths.begin(); 565 QStringList::Iterator it = searchPaths.begin();
566 if ( !globalScope )
567 ++it;
533 while (it != searchPaths.end()) { 568 while (it != searchPaths.end()) {
@@ -566,2 +601,4 @@ void QSettingsPrivate::removeGroup(const QString &key)
566 QStringList::Iterator it = searchPaths.begin(); 601 QStringList::Iterator it = searchPaths.begin();
602 if ( !globalScope )
603 ++it;
567 while (it != searchPaths.end()) { 604 while (it != searchPaths.end()) {
@@ -617,2 +654,4 @@ void QSettingsPrivate::writeGroup(const QString &key, const QString &value)
617 QStringList::Iterator it = searchPaths.begin(); 654 QStringList::Iterator it = searchPaths.begin();
655 if ( !globalScope )
656 ++it;
618 while (it != searchPaths.end()) { 657 while (it != searchPaths.end()) {
@@ -651,2 +690,4 @@ QDateTime QSettingsPrivate::modificationTime()
651 QStringList::Iterator it = searchPaths.begin(); 690 QStringList::Iterator it = searchPaths.begin();
691 if ( !globalScope )
692 ++it;
652 while (it != searchPaths.end()) { 693 while (it != searchPaths.end()) {
@@ -660,3 +701,3 @@ QDateTime QSettingsPrivate::modificationTime()
660 701
661static bool verifyKey( const QString &key ) 702bool qt_verify_key( const QString &key )
662{ 703{
@@ -669,4 +710,10 @@ static inline QString groupKey( const QString &group, const QString &key )
669{ 710{
670 if ( group.endsWith( "/" ) || key.startsWith( "/" ) ) 711 if ( group.isEmpty() || ( group.length() == 1 && group[0] == '/' ) ) {
712 // group is empty, or it contains a single '/', so we just return the key
713 if ( key.startsWith( "/" ) )
714 return key;
715 return "/" + key;
716 } else if ( group.endsWith( "/" ) || key.startsWith( "/" ) ) {
671 return group + key; 717 return group + key;
718 }
672 return group + "/" + key; 719 return group + "/" + key;
@@ -688,3 +735,3 @@ static inline QString groupKey( const QString &group, const QString &key )
688 first folder (listed below) to the last, returning the first 735 first folder (listed below) to the last, returning the first
689 settings found, and ignoring any folders for which the user doesn't 736 settings found, and ignoring any folders for which the user doesn't
690 have read permission. 737 have read permission.
@@ -712,3 +759,3 @@ static inline QString groupKey( const QString &group, const QString &key )
712 If a setting is found in the HKEY_CURRENT_USER space, this setting 759 If a setting is found in the HKEY_CURRENT_USER space, this setting
713 is overwritten independently of write permissions in the 760 is overwritten independently of write permissions in the
714 HKEY_LOCAL_MACHINE space. 761 HKEY_LOCAL_MACHINE space.
@@ -759,3 +806,3 @@ void QSettings::insertSearchPath( System s, const QString &path)
759{ 806{
760#if defined(Q_WS_WIN) || defined(Q_OS_MAC) 807#if !defined(QWS) && (defined(Q_WS_WIN) || defined(Q_OS_MAC))
761 if ( d->sysd ) { 808 if ( d->sysd ) {
@@ -766,3 +813,12 @@ void QSettings::insertSearchPath( System s, const QString &path)
766 813
767 if ( !verifyKey( path ) ) { 814#if !defined(Q_WS_WIN)
815 if ( s == Windows )
816 return;
817#endif
818#if !defined(Q_WS_WIN)
819 if ( s == Mac )
820 return;
821#endif
822
823 if ( !qt_verify_key( path ) ) {
768#if defined(QT_CHECK_STATE) 824#if defined(QT_CHECK_STATE)
@@ -773,3 +829,3 @@ void QSettings::insertSearchPath( System s, const QString &path)
773 829
774#if defined(Q_WS_WIN) || defined(Q_OS_MAC) 830#if !defined(QWS) && (defined(Q_WS_WIN) || defined(Q_OS_MAC))
775 if ( d->sysd && s != Unix ) { 831 if ( d->sysd && s != Unix ) {
@@ -778,3 +834,3 @@ void QSettings::insertSearchPath( System s, const QString &path)
778#endif 834#endif
779#ifdef Q_OS_MAC 835#if !defined(QWS) && defined(Q_OS_MAC)
780 if(s != Mac) //mac is respected on the mac as well 836 if(s != Mac) //mac is respected on the mac as well
@@ -784,5 +840,11 @@ void QSettings::insertSearchPath( System s, const QString &path)
784 840
841 QString realPath = path;
842#if defined(Q_WS_WIN)
843 QString defPath = d->globalScope ? d->searchPaths.first() : d->searchPaths.last();
844 realPath = defPath + path;
845#endif
846
785 QStringList::Iterator it = d->searchPaths.find(d->searchPaths.last()); 847 QStringList::Iterator it = d->searchPaths.find(d->searchPaths.last());
786 if (it != d->searchPaths.end()) { 848 if (it != d->searchPaths.end()) {
787 d->searchPaths.insert(it, path); 849 d->searchPaths.insert(it, realPath);
788 } 850 }
@@ -800,3 +862,3 @@ void QSettings::removeSearchPath( System s, const QString &path)
800{ 862{
801 if ( !verifyKey( path ) ) { 863 if ( !qt_verify_key( path ) ) {
802#if defined(QT_CHECK_STATE) 864#if defined(QT_CHECK_STATE)
@@ -813,3 +875,3 @@ void QSettings::removeSearchPath( System s, const QString &path)
813#endif 875#endif
814#if defined(Q_WS_WIN) || defined(Q_OS_MAC) 876#if !defined(QWS) && (defined(Q_WS_WIN) || defined(Q_OS_MAC))
815 if ( d->sysd && s != Unix ) { 877 if ( d->sysd && s != Unix ) {
@@ -818,3 +880,3 @@ void QSettings::removeSearchPath( System s, const QString &path)
818#endif 880#endif
819#ifdef Q_OS_MAC 881#if !defined(QWS) && defined(Q_OS_MAC)
820 if(s != Mac) //mac is respected on the mac as well 882 if(s != Mac) //mac is respected on the mac as well
@@ -839,3 +901,3 @@ QSettings::QSettings()
839 901
840#if defined(Q_WS_WIN) || defined(Q_OS_MAC) 902#if !defined(QWS) && (defined(Q_WS_WIN) || defined(Q_OS_MAC))
841 d->sysd = 0; 903 d->sysd = 0;
@@ -856,3 +918,3 @@ QSettings::QSettings( Format format )
856 918
857#if defined(Q_WS_WIN) || defined(Q_OS_MAC) 919#if !defined(QWS) && (defined(Q_WS_WIN) || defined(Q_OS_MAC))
858 d->sysd = 0; 920 d->sysd = 0;
@@ -874,3 +936,3 @@ QSettings::~QSettings()
874 936
875#if defined(Q_WS_WIN) || defined(Q_OS_MAC) 937#if !defined(QWS) && (defined(Q_WS_WIN) || defined(Q_OS_MAC))
876 if ( d->sysd ) 938 if ( d->sysd )
@@ -889,3 +951,3 @@ bool QSettings::sync()
889{ 951{
890#if defined(Q_WS_WIN) || defined(Q_OS_MAC) 952#if !defined(QWS) && (defined(Q_WS_WIN) || defined(Q_OS_MAC))
891 if ( d->sysd ) 953 if ( d->sysd )
@@ -907,2 +969,4 @@ bool QSettings::sync()
907 QStringList::Iterator pit = d->searchPaths.begin(); 969 QStringList::Iterator pit = d->searchPaths.begin();
970 if ( !d->globalScope )
971 ++pit;
908 while (pit != d->searchPaths.end()) { 972 while (pit != d->searchPaths.end()) {
@@ -919,5 +983,5 @@ bool QSettings::sync()
919 983
920 it++; 984 ++it;
921 985
922 if (file.name().isNull() || file.name().isEmpty()) { 986 if ( file.name().isEmpty() ) {
923 987
@@ -965,3 +1029,3 @@ bool QSettings::sync()
965 stream << grpit.key() << "=" << v << endl; 1029 stream << grpit.key() << "=" << v << endl;
966 grpit++; 1030 ++grpit;
967 } 1031 }
@@ -971,3 +1035,3 @@ bool QSettings::sync()
971 1035
972 hdit++; 1036 ++hdit;
973 } 1037 }
@@ -1010,3 +1074,3 @@ bool QSettings::readBoolEntry(const QString &key, bool def, bool *ok )
1010{ 1074{
1011 if ( !verifyKey( key ) ) { 1075 if ( !qt_verify_key( key ) ) {
1012#if defined(QT_CHECK_STATE) 1076#if defined(QT_CHECK_STATE)
@@ -1020,9 +1084,8 @@ bool QSettings::readBoolEntry(const QString &key, bool def, bool *ok )
1020 1084
1021 QString theKey = groupKey( group(), key ); 1085#if !defined(QWS) && (defined(Q_WS_WIN) || defined(Q_OS_MAC))
1022#if defined(Q_WS_WIN) || defined(Q_OS_MAC)
1023 if ( d->sysd ) 1086 if ( d->sysd )
1024 return d->sysReadBoolEntry( theKey, def, ok ); 1087 return d->sysReadBoolEntry( groupKey( group(), key ), def, ok );
1025#endif 1088#endif
1026 1089
1027 QString value = readEntry( theKey, ( def ? "true" : "false" ), ok ); 1090 QString value = readEntry( key, ( def ? "true" : "false" ), ok );
1028 1091
@@ -1062,3 +1125,3 @@ double QSettings::readDoubleEntry(const QString &key, double def, bool *ok )
1062{ 1125{
1063 if ( !verifyKey( key ) ) { 1126 if ( !qt_verify_key( key ) ) {
1064#if defined(QT_CHECK_STATE) 1127#if defined(QT_CHECK_STATE)
@@ -1072,9 +1135,8 @@ double QSettings::readDoubleEntry(const QString &key, double def, bool *ok )
1072 1135
1073 QString theKey = groupKey( group(), key ); 1136#if !defined(QWS) && (defined(Q_WS_WIN) || defined(Q_OS_MAC))
1074#if defined(Q_WS_WIN) || defined(Q_OS_MAC)
1075 if ( d->sysd ) 1137 if ( d->sysd )
1076 return d->sysReadDoubleEntry( theKey, def, ok ); 1138 return d->sysReadDoubleEntry( groupKey( group(), key ), def, ok );
1077#endif 1139#endif
1078 1140
1079 QString value = readEntry( theKey, QString::number(def), ok ); 1141 QString value = readEntry( key, QString::number(def), ok );
1080 bool conv_ok; 1142 bool conv_ok;
@@ -1108,3 +1170,3 @@ int QSettings::readNumEntry(const QString &key, int def, bool *ok )
1108{ 1170{
1109 if ( !verifyKey( key ) ) { 1171 if ( !qt_verify_key( key ) ) {
1110#if defined(QT_CHECK_STATE) 1172#if defined(QT_CHECK_STATE)
@@ -1117,10 +1179,8 @@ int QSettings::readNumEntry(const QString &key, int def, bool *ok )
1117 1179
1118 QString theKey = groupKey( group(), key ); 1180#if !defined(QWS) && (defined(Q_WS_WIN) || defined(Q_OS_MAC))
1119
1120#if defined(Q_WS_WIN) || defined(Q_OS_MAC)
1121 if ( d->sysd ) 1181 if ( d->sysd )
1122 return d->sysReadNumEntry( theKey, def, ok ); 1182 return d->sysReadNumEntry( groupKey( group(), key ), def, ok );
1123#endif 1183#endif
1124 1184
1125 QString value = readEntry( theKey, QString::number( def ), ok ); 1185 QString value = readEntry( key, QString::number( def ), ok );
1126 bool conv_ok; 1186 bool conv_ok;
@@ -1154,3 +1214,3 @@ QString QSettings::readEntry(const QString &key, const QString &def, bool *ok )
1154{ 1214{
1155 if ( !verifyKey( key ) ) { 1215 if ( !qt_verify_key( key ) ) {
1156#if defined(QT_CHECK_STATE) 1216#if defined(QT_CHECK_STATE)
@@ -1166,3 +1226,3 @@ QString QSettings::readEntry(const QString &key, const QString &def, bool *ok )
1166 1226
1167#if defined(Q_WS_WIN) || defined(Q_OS_MAC) 1227#if !defined(QWS) && (defined(Q_WS_WIN) || defined(Q_OS_MAC))
1168 if ( d->sysd ) 1228 if ( d->sysd )
@@ -1208,7 +1268,9 @@ QString QSettings::readEntry(const QString &key, const QString &def, bool *ok )
1208 QSettingsGroup grp = d->readGroup(); 1268 QSettingsGroup grp = d->readGroup();
1209 QString retval = grp[realkey]; 1269 QSettingsGroup::const_iterator it = grp.find( realkey ), end = grp.end();
1210 if ( retval.isNull() ) 1270 QString retval = def;
1211 retval = def; 1271 if ( it != end ) {
1212 else if ( ok ) // everything is ok 1272 // found the value we needed
1213 *ok = TRUE; 1273 retval = *it;
1274 if ( ok ) *ok = TRUE;
1275 }
1214 return retval; 1276 return retval;
@@ -1230,3 +1292,3 @@ bool QSettings::writeEntry(const QString &key, bool value)
1230{ 1292{
1231 if ( !verifyKey( key ) ) { 1293 if ( !qt_verify_key( key ) ) {
1232#if defined(QT_CHECK_STATE) 1294#if defined(QT_CHECK_STATE)
@@ -1237,10 +1299,8 @@ bool QSettings::writeEntry(const QString &key, bool value)
1237 1299
1238 QString theKey = groupKey( group(), key ); 1300#if !defined(QWS) && (defined(Q_WS_WIN) || defined(Q_OS_MAC))
1239
1240#if defined(Q_WS_WIN) || defined(Q_OS_MAC)
1241 if ( d->sysd ) 1301 if ( d->sysd )
1242 return d->sysWriteEntry( theKey, value ); 1302 return d->sysWriteEntry( groupKey( group(), key ), value );
1243#endif 1303#endif
1244 QString s(value ? "true" : "false"); 1304 QString s(value ? "true" : "false");
1245 return writeEntry(theKey, s); 1305 return writeEntry(key, s);
1246} 1306}
@@ -1262,3 +1322,3 @@ bool QSettings::writeEntry(const QString &key, double value)
1262{ 1322{
1263 if ( !verifyKey( key ) ) { 1323 if ( !qt_verify_key( key ) ) {
1264#if defined(QT_CHECK_STATE) 1324#if defined(QT_CHECK_STATE)
@@ -1269,10 +1329,8 @@ bool QSettings::writeEntry(const QString &key, double value)
1269 1329
1270 QString theKey = groupKey( group(), key ); 1330#if !defined(QWS) && (defined(Q_WS_WIN) || defined(Q_OS_MAC))
1271
1272#if defined(Q_WS_WIN) || defined(Q_OS_MAC)
1273 if ( d->sysd ) 1331 if ( d->sysd )
1274 return d->sysWriteEntry( theKey, value ); 1332 return d->sysWriteEntry( groupKey( group(), key ), value );
1275#endif 1333#endif
1276 QString s(QString::number(value)); 1334 QString s(QString::number(value));
1277 return writeEntry(theKey, s); 1335 return writeEntry(key, s);
1278} 1336}
@@ -1293,3 +1351,3 @@ bool QSettings::writeEntry(const QString &key, int value)
1293{ 1351{
1294 if ( !verifyKey( key ) ) { 1352 if ( !qt_verify_key( key ) ) {
1295#if defined(QT_CHECK_STATE) 1353#if defined(QT_CHECK_STATE)
@@ -1300,10 +1358,8 @@ bool QSettings::writeEntry(const QString &key, int value)
1300 1358
1301 QString theKey = groupKey( group(), key ); 1359#if !defined(QWS) && (defined(Q_WS_WIN) || defined(Q_OS_MAC))
1302
1303#if defined(Q_WS_WIN) || defined(Q_OS_MAC)
1304 if ( d->sysd ) 1360 if ( d->sysd )
1305 return d->sysWriteEntry( theKey, value ); 1361 return d->sysWriteEntry( groupKey( group(), key ), value );
1306#endif 1362#endif
1307 QString s(QString::number(value)); 1363 QString s(QString::number(value));
1308 return writeEntry(theKey, s); 1364 return writeEntry(key, s);
1309} 1365}
@@ -1329,3 +1385,3 @@ bool QSettings::writeEntry(const QString &key, const char *value)
1329{ 1385{
1330 if ( !verifyKey( key ) ) { 1386 if ( !qt_verify_key( key ) ) {
1331#if defined(QT_CHECK_STATE) 1387#if defined(QT_CHECK_STATE)
@@ -1336,5 +1392,3 @@ bool QSettings::writeEntry(const QString &key, const char *value)
1336 1392
1337 QString theKey = groupKey( group(), key ); 1393 return writeEntry(key, QString(value));
1338
1339 return writeEntry(theKey, QString(value));
1340} 1394}
@@ -1356,3 +1410,3 @@ bool QSettings::writeEntry(const QString &key, const QString &value)
1356{ 1410{
1357 if ( !verifyKey( key ) ) { 1411 if ( !qt_verify_key( key ) ) {
1358#if defined(QT_CHECK_STATE) 1412#if defined(QT_CHECK_STATE)
@@ -1365,3 +1419,3 @@ bool QSettings::writeEntry(const QString &key, const QString &value)
1365 1419
1366#if defined(Q_WS_WIN) || defined(Q_OS_MAC) 1420#if !defined(QWS) && (defined(Q_WS_WIN) || defined(Q_OS_MAC))
1367 if ( d->sysd ) 1421 if ( d->sysd )
@@ -1417,3 +1471,3 @@ bool QSettings::removeEntry(const QString &key)
1417{ 1471{
1418 if ( !verifyKey( key ) ) { 1472 if ( !qt_verify_key( key ) ) {
1419#if defined(QT_CHECK_STATE) 1473#if defined(QT_CHECK_STATE)
@@ -1426,3 +1480,3 @@ bool QSettings::removeEntry(const QString &key)
1426 1480
1427#if defined(Q_WS_WIN) || defined(Q_OS_MAC) 1481#if !defined(QWS) && (defined(Q_WS_WIN) || defined(Q_OS_MAC))
1428 if ( d->sysd ) 1482 if ( d->sysd )
@@ -1496,3 +1550,3 @@ QStringList QSettings::entryList(const QString &key) const
1496{ 1550{
1497 if ( !verifyKey( key ) ) { 1551 if ( !qt_verify_key( key ) ) {
1498#if defined(QT_CHECK_STATE) 1552#if defined(QT_CHECK_STATE)
@@ -1505,3 +1559,3 @@ QStringList QSettings::entryList(const QString &key) const
1505 1559
1506#if defined(Q_WS_WIN) || defined(Q_OS_MAC) 1560#if !defined(QWS) && (defined(Q_WS_WIN) || defined(Q_OS_MAC))
1507 if ( d->sysd ) 1561 if ( d->sysd )
@@ -1546,3 +1600,3 @@ QStringList QSettings::entryList(const QString &key) const
1546 itkey = it.key(); 1600 itkey = it.key();
1547 it++; 1601 ++it;
1548 1602
@@ -1593,3 +1647,3 @@ QStringList QSettings::subkeyList(const QString &key) const
1593{ 1647{
1594 if ( !verifyKey( key ) ) { 1648 if ( !qt_verify_key( key ) ) {
1595#if defined(QT_CHECK_STATE) 1649#if defined(QT_CHECK_STATE)
@@ -1602,3 +1656,3 @@ QStringList QSettings::subkeyList(const QString &key) const
1602 1656
1603#if defined(Q_WS_WIN) || defined(Q_OS_MAC) 1657#if !defined(QWS) && (defined(Q_WS_WIN) || defined(Q_OS_MAC))
1604 if ( d->sysd ) 1658 if ( d->sysd )
@@ -1608,2 +1662,3 @@ QStringList QSettings::subkeyList(const QString &key) const
1608 QString realkey; 1662 QString realkey;
1663 int subkeycount = 2;
1609 if (theKey[0] == '/') { 1664 if (theKey[0] == '/') {
@@ -1620,2 +1675,4 @@ QStringList QSettings::subkeyList(const QString &key) const
1620 1675
1676 subkeycount = list.count();
1677
1621 if (list.count() == 1) { 1678 if (list.count() == 1) {
@@ -1634,2 +1691,3 @@ QStringList QSettings::subkeyList(const QString &key) const
1634 } 1691 }
1692
1635 } else 1693 } else
@@ -1637,5 +1695,16 @@ QStringList QSettings::subkeyList(const QString &key) const
1637 1695
1696 QStringList ret;
1697 if ( subkeycount == 1 ) {
1698 QMap<QString,QSettingsHeading>::Iterator it = d->headings.begin();
1699 while ( it != d->headings.end() ) {
1700 if ( it.key() != "General" && ! ret.contains( it.key() ) )
1701 ret << it.key();
1702 ++it;
1703 }
1704
1705 return ret;
1706 }
1707
1638 QSettingsGroup grp = d->readGroup(); 1708 QSettingsGroup grp = d->readGroup();
1639 QSettingsGroup::Iterator it = grp.begin(); 1709 QSettingsGroup::Iterator it = grp.begin();
1640 QStringList ret;
1641 QString itkey; 1710 QString itkey;
@@ -1643,3 +1712,3 @@ QStringList QSettings::subkeyList(const QString &key) const
1643 itkey = it.key(); 1712 itkey = it.key();
1644 it++; 1713 ++it;
1645 1714
@@ -1672,3 +1741,3 @@ QDateTime QSettings::lastModficationTime(const QString &key)
1672{ 1741{
1673 if ( !verifyKey( key ) ) { 1742 if ( !qt_verify_key( key ) ) {
1674#if defined(QT_CHECK_STATE) 1743#if defined(QT_CHECK_STATE)
@@ -1681,3 +1750,3 @@ QDateTime QSettings::lastModficationTime(const QString &key)
1681 1750
1682#if defined(Q_WS_WIN) || defined(Q_OS_MAC) 1751#if !defined(QWS) && (defined(Q_WS_WIN) || defined(Q_OS_MAC))
1683 if ( d->sysd ) 1752 if ( d->sysd )
@@ -1717,5 +1786,13 @@ QDateTime QSettings::lastModficationTime(const QString &key)
1717 by \a value. The list is stored as a sequence of strings separated 1786 by \a value. The list is stored as a sequence of strings separated
1718 by \a separator, so none of the strings in the list should contain 1787 by \a separator (using QStringList::join()), so none of the
1719 the separator. If the list is empty or null the key's value will 1788 strings in the list should contain the separator. If the list is
1720 be an empty string. 1789 empty or null the key's value will be an empty string.
1790
1791 \warning The list should not contain empty or null strings, as
1792 readListEntry() will use QStringList::split() to recreate the
1793 list. As the documentation states, QStringList::split() will omit
1794 empty strings from the list. Because of this, it is impossible to
1795 retrieve identical list data that is stored with this function.
1796 We recommend using the writeEntry() and readListEntry() overloads
1797 that do not take a \a separator argument.
1721 1798
@@ -1770,2 +1847,9 @@ bool QSettings::writeEntry(const QString &key, const QStringList &value)
1770 1847
1848 \warning As the documentation states, QStringList::split() will
1849 omit empty strings from the list. Because of this, it is
1850 impossible to retrieve identical list data with this function. We
1851 recommend using the readListEntry() and writeEntry() overloads
1852 that do not take a \a separator argument.
1853
1854
1771 Note that if you want to iterate over the list, you should iterate 1855 Note that if you want to iterate over the list, you should iterate
@@ -1849,15 +1933,22 @@ QStringList QSettings::readListEntry(const QString &key, bool *ok )
1849 1933
1934#ifdef Q_OS_MAC
1935void qt_setSettingsBasePath(const QString &); //qsettings_mac.cpp
1936#endif
1937
1850/*! 1938/*!
1851 Insert platform-dependent paths from platform-independent information. 1939 Insert platform-dependent paths from platform-independent information.
1940
1941 The \a domain should be an Internet domain name
1942 controlled by the producer of the software, eg. Trolltech products
1943 use "trolltech.com".
1852 1944
1853 The \a domain should be an Internet domain name 1945 The \a product should be the official name of the product.
1854 controlled by the producer of the software, eg. Trolltech products
1855 use "trolltech.com".
1856 1946
1857 The \a product should be the official name of the product. 1947 The \a scope should be
1948 QSettings::User for user-specific settings, or
1949 QSettings::Global for system-wide settings (generally
1950 these will be read-only to many users).
1858 1951
1859 The \a scope should be 1952 Not all information is relevant on all systems (e.g. scoping is
1860 QSettings::User for user-specific settings, or 1953 currently used only if QSettings accesses the Windows registry).
1861 QSettings::Global for system-wide settings (generally
1862 these will be read-only to many users).
1863*/ 1954*/
@@ -1875,3 +1966,3 @@ void QSettings::setPath( const QString &domain, const QString &product, Scope sc
1875// scope. 1966// scope.
1876// 1967//
1877// On MacOS X, if there is no "." in domain, append ".com", then reverse the 1968// On MacOS X, if there is no "." in domain, append ".com", then reverse the
@@ -1882,2 +1973,4 @@ void QSettings::setPath( const QString &domain, const QString &product, Scope sc
1882// scope. 1973// scope.
1974 d->globalScope = scope == Global;
1975
1883 QString actualSearchPath; 1976 QString actualSearchPath;
@@ -1888,7 +1981,7 @@ void QSettings::setPath( const QString &domain, const QString &product, Scope sc
1888 insertSearchPath( Windows, actualSearchPath ); 1981 insertSearchPath( Windows, actualSearchPath );
1889#elif defined(Q_WS_MAC) 1982#elif !defined(QWS) && defined(Q_OS_MAC)
1890 QString topLevelDomain = domain.right( domain.length() - lastDot - 1 ) + "."; 1983 QString topLevelDomain = domain.right( domain.length() - lastDot - 1 ) + ".";
1891 if ( topLevelDomain.isEmpty() ) 1984 if ( !topLevelDomain.isEmpty() )
1892 topLevelDomain = "com."; 1985 qt_setSettingsBasePath( topLevelDomain );
1893 actualSearchPath = "/" + topLevelDomain + domain.left( lastDot ) + product; 1986 actualSearchPath = "/" + domain.left( lastDot ) + product;
1894 insertSearchPath( Mac, actualSearchPath ); 1987 insertSearchPath( Mac, actualSearchPath );
@@ -1898,4 +1991,2 @@ void QSettings::setPath( const QString &domain, const QString &product, Scope sc
1898#endif 1991#endif
1899
1900 d->globalScope = scope == Global;
1901} 1992}
@@ -1904,2 +1995,9 @@ void QSettings::setPath( const QString &domain, const QString &product, Scope sc
1904 Appends \a group to the current key prefix. 1995 Appends \a group to the current key prefix.
1996
1997 \code
1998 QSettings settings;
1999 settings.beginGroup( "/MainWindow" );
2000 // read values
2001 settings.endGroup();
2002 \endcode
1905*/ 2003*/
@@ -1914,2 +2012,9 @@ void QSettings::beginGroup( const QString &group )
1914 by a single call to endGroup(). 2012 by a single call to endGroup().
2013
2014 \code
2015 QSettings settings;
2016 settings.beginGroup( "/MainWindow/Geometry" );
2017 // read values
2018 settings.endGroup();
2019 \endcode
1915*/ 2020*/
@@ -1947,3 +2052,3 @@ QString QSettings::group() const
1947 if ( group[0] != '/' ) 2052 if ( group[0] != '/' )
1948 group = "/" + group; 2053 group.prepend( "/" );
1949 d->groupPrefix += group; 2054 d->groupPrefix += group;
diff --git a/qmake/tools/qstring.cpp b/qmake/tools/qstring.cpp
index 56df62b..7f1fac3 100644
--- a/qmake/tools/qstring.cpp
+++ b/qmake/tools/qstring.cpp
@@ -7,3 +7,3 @@
7** 7**
8** Copyright (C) 1992-2000 Trolltech AS. All rights reserved. 8** Copyright (C) 1992-2002 Trolltech AS. All rights reserved.
9** 9**
@@ -49,3 +49,2 @@
49#endif 49#endif
50#include <ctype.h>
51#include <limits.h> 50#include <limits.h>
@@ -54,2 +53,3 @@
54#include <stdlib.h> 53#include <stdlib.h>
54#include <string.h>
55#if defined(Q_WS_WIN) 55#if defined(Q_WS_WIN)
@@ -61,2 +61,6 @@
61 61
62#ifdef QT_NO_UNICODETABLES
63# include <ctype.h>
64#endif
65
62 66
@@ -11789,2 +11793,3 @@ static inline QChar::Direction direction( const QChar &c )
11789#else 11793#else
11794 Q_UNUSED(c);
11790 return QChar::DirL; 11795 return QChar::DirL;
@@ -11801,2 +11806,3 @@ static inline bool mirrored( const QChar &c )
11801#else 11806#else
11807 Q_UNUSED(c);
11802 return FALSE; 11808 return FALSE;
@@ -11902,3 +11908,3 @@ static uint computeNewMax( uint len )
11902 newMax *= 2; 11908 newMax *= 2;
11903 // try to spare some memory 11909 // try to save some memory
11904 if ( newMax >= 1024 * 1024 && len <= newMax - (newMax >> 2) ) 11910 if ( newMax >= 1024 * 1024 && len <= newMax - (newMax >> 2) )
@@ -12893,3 +12899,3 @@ void QString::compose()
12893 12899
12894QChar* QString::asciiToUnicode( const QByteArray& ba, uint* len ) 12900QChar* QString::latin1ToUnicode( const QByteArray& ba, uint* len )
12895{ 12901{
@@ -12912,3 +12918,3 @@ QChar* QString::asciiToUnicode( const QByteArray& ba, uint* len )
12912 12918
12913static QChar* internalAsciiToUnicode( const QByteArray& ba, uint* len ) 12919static QChar* internalLatin1ToUnicode( const QByteArray& ba, uint* len )
12914{ 12920{
@@ -12942,3 +12948,3 @@ static QChar* internalAsciiToUnicode( const QByteArray& ba, uint* len )
12942 12948
12943QChar* QString::asciiToUnicode( const char *str, uint* len, uint maxlen ) 12949QChar* QString::latin1ToUnicode( const char *str, uint* len, uint maxlen )
12944{ 12950{
@@ -12952,3 +12958,3 @@ QChar* QString::asciiToUnicode( const char *str, uint* len, uint maxlen )
12952 // Faster? 12958 // Faster?
12953 l = qstrlen(str); 12959 l = strlen( str );
12954 } 12960 }
@@ -12965,3 +12971,3 @@ QChar* QString::asciiToUnicode( const char *str, uint* len, uint maxlen )
12965 12971
12966static QChar* internalAsciiToUnicode( const char *str, uint* len, 12972static QChar* internalLatin1ToUnicode( const char *str, uint* len,
12967 uint maxlen = (uint)-1 ) 12973 uint maxlen = (uint)-1 )
@@ -12976,3 +12982,3 @@ static QChar* internalAsciiToUnicode( const char *str, uint* len,
12976 // Faster? 12982 // Faster?
12977 l = qstrlen(str); 12983 l = strlen( str );
12978 } 12984 }
@@ -12996,3 +13002,3 @@ static QChar* internalAsciiToUnicode( const char *str, uint* len,
12996*/ 13002*/
12997char* QString::unicodeToAscii(const QChar *uc, uint l) 13003char* QString::unicodeToLatin1(const QChar *uc, uint l)
12998{ 13004{
@@ -13159,31 +13165,2 @@ QStringData* QString::makeSharedNull()
13159 13165
13160// Uncomment this to get some useful statistics.
13161// #define Q2HELPER(x) x
13162
13163#ifdef Q2HELPER
13164static int stat_construct_charstar=0;
13165static int stat_construct_charstar_size=0;
13166static int stat_construct_null=0;
13167static int stat_construct_int=0;
13168static int stat_construct_int_size=0;
13169static int stat_construct_ba=0;
13170static int stat_get_ascii=0;
13171static int stat_get_ascii_size=0;
13172static int stat_copy_on_write=0;
13173static int stat_copy_on_write_size=0;
13174static int stat_fast_copy=0;
13175Q_EXPORT void qt_qstring_stats()
13176{
13177 qDebug("construct_charstar = %d (%d chars)", stat_construct_charstar, stat_construct_charstar_size);
13178 qDebug("construct_null = %d", stat_construct_null);
13179 qDebug("construct_int = %d (%d chars)", stat_construct_int, stat_construct_int_size);
13180 qDebug("construct_ba = %d", stat_construct_ba);
13181 qDebug("get_ascii = %d (%d chars)", stat_get_ascii, stat_get_ascii_size);
13182 qDebug("copy_on_write = %d (%d chars)", stat_copy_on_write, stat_copy_on_write_size);
13183 qDebug("fast_copy = %d", stat_fast_copy);
13184}
13185#else
13186#define Q2HELPER(x)
13187#endif
13188
13189/*! 13166/*!
@@ -13213,3 +13190,2 @@ QString::QString( const QString &s ) :
13213{ 13190{
13214 Q2HELPER(stat_fast_copy++)
13215 d->ref(); 13191 d->ref();
@@ -13232,5 +13208,3 @@ QString::QString( int size, bool /*dummy*/ )
13232 if ( size ) { 13208 if ( size ) {
13233 Q2HELPER(stat_construct_int++)
13234 int l = size; 13209 int l = size;
13235 Q2HELPER(stat_construct_int_size+=l)
13236 QChar* uc = QT_ALLOC_QCHAR_VEC( l ); 13210 QChar* uc = QT_ALLOC_QCHAR_VEC( l );
@@ -13238,3 +13212,2 @@ QString::QString( int size, bool /*dummy*/ )
13238 } else { 13212 } else {
13239 Q2HELPER(stat_construct_null++)
13240 d = shared_null ? shared_null : (shared_null=new QStringData); 13213 d = shared_null ? shared_null : (shared_null=new QStringData);
@@ -13251,5 +13224,11 @@ QString::QString( const QByteArray& ba )
13251{ 13224{
13252 Q2HELPER(stat_construct_ba++) 13225#ifndef QT_NO_TEXTCODEC
13226 if ( QTextCodec::codecForCStrings() ) {
13227 d = 0;
13228 *this = fromAscii( ba.data(), ba.size() );
13229 return;
13230 }
13231#endif
13253 uint l; 13232 uint l;
13254 QChar *uc = internalAsciiToUnicode(ba,&l); 13233 QChar *uc = internalLatin1ToUnicode(ba,&l);
13255 d = new QStringData(uc,l,l); 13234 d = new QStringData(uc,l,l);
@@ -13304,8 +13283,35 @@ QString::QString( const char *str )
13304{ 13283{
13305 Q2HELPER(stat_construct_charstar++) 13284#ifndef QT_NO_TEXTCODEC
13285 if ( QTextCodec::codecForCStrings() ) {
13286 d = 0;
13287 *this = fromAscii( str );
13288 return;
13289 }
13290#endif
13291 uint l;
13292 QChar *uc = internalLatin1ToUnicode(str,&l);
13293 d = new QStringData(uc,l,l);
13294}
13295
13296#ifndef QT_NO_STL
13297/*!
13298 Constructs a string that is a deep copy of \a str.
13299
13300 This is the same as fromAscii(\a str).
13301*/
13302
13303QString::QString( const std::string &str )
13304{
13305#ifndef QT_NO_TEXTCODEC
13306 if ( QTextCodec::codecForCStrings() ) {
13307 d = 0;
13308 *this = fromAscii( str.c_str() );
13309 return;
13310 }
13311#endif
13306 uint l; 13312 uint l;
13307 QChar *uc = internalAsciiToUnicode(str,&l); 13313 QChar *uc = internalLatin1ToUnicode(str.c_str(),&l);
13308 Q2HELPER(stat_construct_charstar_size+=l)
13309 d = new QStringData(uc,l,l); 13314 d = new QStringData(uc,l,l);
13310} 13315}
13316#endif
13311 13317
@@ -13335,6 +13341,6 @@ void QString::deref()
13335{ 13341{
13336 if ( d->deref() ) { 13342 if ( d && d->deref() ) {
13337 if ( d != shared_null ) 13343 if ( d != shared_null )
13338 delete d; 13344 delete d;
13339 d = 0; // helps debugging 13345 d = 0;
13340 } 13346 }
@@ -13354,2 +13360,11 @@ void QStringData::deleteSelf()
13354/*! 13360/*!
13361 \fn QString& QString::operator=( const std::string& s )
13362
13363 \overload
13364
13365 Makes a deep copy of \a s and returns a reference to the deep
13366 copy.
13367*/
13368
13369/*!
13355 \fn QString& QString::operator=( char c ) 13370 \fn QString& QString::operator=( char c )
@@ -13370,3 +13385,2 @@ QString &QString::operator=( const QString &s )
13370{ 13385{
13371 Q2HELPER(stat_fast_copy++)
13372 s.d->ref(); 13386 s.d->ref();
@@ -13385,3 +13399,3 @@ QString &QString::operator=( const QCString& cs )
13385{ 13399{
13386 return setLatin1(cs); 13400 return setAscii(cs);
13387} 13401}
@@ -13401,3 +13415,3 @@ QString &QString::operator=( const char *str )
13401{ 13415{
13402 return setLatin1(str); 13416 return setAscii(str);
13403} 13417}
@@ -13473,4 +13487,3 @@ void QString::truncate( uint newLen )
13473 13487
13474 If \a newLen is 0, then the string becomes empty, unless the 13488 If \a newLen is 0, then the string becomes empty (non-null).
13475 string is null, in which case it remains null.
13476 13489
@@ -13488,8 +13501,8 @@ void QString::truncate( uint newLen )
13488 QString result; 13501 QString result;
13489 int resultLength = 0; 13502 int len = 0;
13490 result.setLength( newLen ) // allocate some space 13503 result.setLength( maxLen ); // allocate some space
13491 while ( ... ) { 13504 while ( ... ) {
13492 result[resultLength++] = ... // fill (part of) the space with data 13505 result[len++] = ... // fill part of the space
13493 } 13506 }
13494 result.truncate[resultLength]; // and get rid of the undefined junk 13507 result.truncate( len ); // and get rid of the rest
13495 \endcode 13508 \endcode
@@ -13507,4 +13520,2 @@ void QString::setLength( uint newLen )
13507 // detach, grow or shrink 13520 // detach, grow or shrink
13508 Q2HELPER(stat_copy_on_write++)
13509 Q2HELPER(stat_copy_on_write_size+=d->len)
13510 uint newMax = computeNewMax( newLen ); 13521 uint newMax = computeNewMax( newLen );
@@ -13532,17 +13543,16 @@ void QString::setLength( uint newLen )
13532 13543
13544 The following example shows how we could create a 'status' string
13545 when processing a list of files:
13533 \code 13546 \code
13534 QString firstName( "Joe" ); 13547 QString status = QString( "Processing file %1 of %2: %3" )
13535 QString lastName( "Bloggs" ); 13548 .arg( i ) // current file's number
13536 QString fullName; 13549 .arg( total ) // number of files to process
13537 fullName = QString( "First name is '%1', last name is '%2'" ) 13550 .arg( fileName ); // current file's name
13538 .arg( firstName )
13539 .arg( lastName );
13540
13541 // fullName == First name is 'Joe', last name is 'Bloggs'
13542 \endcode 13551 \endcode
13543 13552
13544 Note that using arg() to construct sentences as we've done in the 13553 It is generally fine to use filenames and numbers as we have done
13545 example above does not usually translate well into other languages 13554 in the example above. But note that using arg() to construct
13546 because sentence structure and word order often differ between 13555 natural language sentences does not usually translate well into
13547 languages. 13556 other languages because sentence structure and word order often
13557 differ between languages.
13548 13558
@@ -13776,3 +13786,3 @@ QString &QString::sprintf( const char* cformat, ... )
13776 } 13786 }
13777 QString format = fromLatin1( cformat ); 13787 QString format = fromAscii( cformat );
13778 13788
@@ -13915,3 +13925,3 @@ QString &QString::sprintf( const char* cformat, ... )
13915 } 13925 }
13916 replacement = fromLatin1( out ); 13926 replacement = fromAscii( out );
13917 } 13927 }
@@ -14126,4 +14136,6 @@ int QString::find( const QString& str, int index, bool cs ) const
14126 14136
14137#ifndef MACOSX_101
14127 if ( sl == 1 ) 14138 if ( sl == 1 )
14128 return find( *str.unicode(), index, cs ); 14139 return find( *str.unicode(), index, cs );
14140#endif
14129 14141
@@ -14223,2 +14235,5 @@ int QString::findRev( QChar c, int index, bool cs ) const
14223{ 14235{
14236#ifdef MACOSX_101
14237 return findRev( QString( c ), index, cs );
14238#else
14224 const uint l = length(); 14239 const uint l = length();
@@ -14239,2 +14254,3 @@ int QString::findRev( QChar c, int index, bool cs ) const
14239 return uc - end; 14254 return uc - end;
14255#endif
14240} 14256}
@@ -14275,4 +14291,6 @@ int QString::findRev( const QString& str, int index, bool cs ) const
14275 14291
14292#ifndef MACOSX_101
14276 if ( sl == 1 ) 14293 if ( sl == 1 )
14277 return findRev( *str.unicode(), index, cs ); 14294 return findRev( *str.unicode(), index, cs );
14295#endif
14278 14296
@@ -14981,15 +14999,20 @@ QString QString::lower() const
14981{ 14999{
14982 QString s(*this); 15000 int l = length();
14983 int l=length(); 15001 register QChar *p = d->unicode;
14984 if ( l ) { 15002 while ( l ) {
14985 s.real_detach(); // could do this only when we find a change 15003 if ( *p != ::lower(*p) ) {
14986 register QChar *p=s.d->unicode; 15004 QString s( *this );
14987 if ( p ) { 15005 s.real_detach();
14988 while ( l-- ) { 15006 p = s.d->unicode + ( p - d->unicode );
15007 while ( l ) {
14989 *p = ::lower( *p ); 15008 *p = ::lower( *p );
15009 l--;
14990 p++; 15010 p++;
14991 } 15011 }
15012 return s;
14992 } 15013 }
15014 l--;
15015 p++;
14993 } 15016 }
14994 return s; 15017 return *this;
14995} 15018}
@@ -15009,15 +15032,20 @@ QString QString::upper() const
15009{ 15032{
15010 QString s(*this); 15033 int l = length();
15011 int l=length(); 15034 register QChar *p = d->unicode;
15012 if ( l ) { 15035 while ( l ) {
15013 s.real_detach(); // could do this only when we find a change 15036 if ( *p != ::upper(*p) ) {
15014 register QChar *p=s.d->unicode; 15037 QString s( *this );
15015 if ( p ) { 15038 s.real_detach();
15016 while ( l-- ) { 15039 p = s.d->unicode + ( p - d->unicode );
15040 while ( l ) {
15017 *p = ::upper( *p ); 15041 *p = ::upper( *p );
15042 l--;
15018 p++; 15043 p++;
15019 } 15044 }
15045 return s;
15020 } 15046 }
15047 l--;
15048 p++;
15021 } 15049 }
15022 return s; 15050 return *this;
15023} 15051}
@@ -15139,4 +15167,4 @@ QString &QString::insert( uint index, const QString &s )
15139 15167
15140 Inserts the character in \a s into the string at position \a index 15168 Inserts the first \a len characters in \a s into the string at
15141 \a len number of times and returns a reference to the string. 15169 position \a index and returns a reference to the string.
15142*/ 15170*/
@@ -15253,2 +15281,12 @@ QString &QString::insert( uint index, QChar c ) // insert char
15253 15281
15282/*! \fn QString& QString::prepend( const std::string &s )
15283 \overload
15284
15285 Inserts \a s at the beginning of the string and returns a reference to the string.
15286
15287 Equivalent to insert(0, \a s).
15288
15289 \sa insert()
15290 */
15291
15254/*! 15292/*!
@@ -15850,5 +15888,5 @@ long QString::toLong( bool *ok, int base ) const
15850 const QChar *p = unicode(); 15888 const QChar *p = unicode();
15851 long val = 0; 15889 ulong val = 0;
15852 int l = length(); 15890 int l = length();
15853 const long max_mult = INT_MAX / base; 15891 const ulong max_mult = LONG_MAX / base;
15854 bool is_ok = FALSE; 15892 bool is_ok = FALSE;
@@ -15885,3 +15923,3 @@ long QString::toLong( bool *ok, int base ) const
15885 if ( val > max_mult || 15923 if ( val > max_mult ||
15886 (val == max_mult && dv > (INT_MAX % base) + neg) ) 15924 (val == max_mult && dv > (LONG_MAX % base) + neg) )
15887 goto bye; 15925 goto bye;
@@ -15890,6 +15928,4 @@ long QString::toLong( bool *ok, int base ) const
15890 } 15928 }
15891 if ( neg )
15892 val = -val;
15893 while ( l && p->isSpace() ) // skip trailing space 15929 while ( l && p->isSpace() ) // skip trailing space
15894 l--,p++; 15930 l--, p++;
15895 if ( !l ) 15931 if ( !l )
@@ -15899,3 +15935,3 @@ bye:
15899 *ok = is_ok; 15935 *ok = is_ok;
15900 return is_ok ? val : 0; 15936 return is_ok ? ( neg ? -( (long) val ) : (long) val ) : 0L;
15901} 15937}
@@ -15917,3 +15953,3 @@ ulong QString::toULong( bool *ok, int base ) const
15917 int l = length(); 15953 int l = length();
15918 const ulong max_mult = UINT_MAX / base; 15954 const ulong max_mult = ULONG_MAX / base;
15919 bool is_ok = FALSE; 15955 bool is_ok = FALSE;
@@ -15942,3 +15978,3 @@ ulong QString::toULong( bool *ok, int base ) const
15942 } 15978 }
15943 if ( val > max_mult || (val == max_mult && dv > UINT_MAX % base) ) 15979 if ( val > max_mult || (val == max_mult && dv > ULONG_MAX % base) )
15944 goto bye; 15980 goto bye;
@@ -15969,3 +16005,3 @@ short QString::toShort( bool *ok, int base ) const
15969 long v = toLong( ok, base ); 16005 long v = toLong( ok, base );
15970 if ( ok && *ok && (v < -32768 || v > 32767) ) { 16006 if ( ok && *ok && (v < SHRT_MIN || v > SHRT_MAX) ) {
15971 *ok = FALSE; 16007 *ok = FALSE;
@@ -15988,3 +16024,3 @@ ushort QString::toUShort( bool *ok, int base ) const
15988 ulong v = toULong( ok, base ); 16024 ulong v = toULong( ok, base );
15989 if ( ok && *ok && (v > 65535) ) { 16025 if ( ok && *ok && (v > USHRT_MAX) ) {
15990 *ok = FALSE; 16026 *ok = FALSE;
@@ -16015,3 +16051,8 @@ int QString::toInt( bool *ok, int base ) const
16015{ 16051{
16016 return (int)toLong( ok, base ); 16052 long v = toLong( ok, base );
16053 if ( ok && *ok && (v < INT_MIN || v > INT_MAX) ) {
16054 *ok = FALSE;
16055 v = 0;
16056 }
16057 return (int)v;
16017} 16058}
@@ -16030,3 +16071,8 @@ uint QString::toUInt( bool *ok, int base ) const
16030{ 16071{
16031 return (uint)toULong( ok, base ); 16072 ulong v = toULong( ok, base );
16073 if ( ok && *ok && (v > UINT_MAX) ) {
16074 *ok = FALSE;
16075 v = 0;
16076 }
16077 return (uint)v;
16032} 16078}
@@ -16054,3 +16100,3 @@ double QString::toDouble( bool *ok ) const
16054 if ( ok ) 16100 if ( ok )
16055 *ok = ( a && *a && (end == 0 || (end - a) == (int)length()) ); 16101 *ok = ( a && *a && (end == 0 || *end == '\0') );
16056 return val; 16102 return val;
@@ -16100,7 +16146,7 @@ QString &QString::setNum( long n, int base )
16100 neg = TRUE; 16146 neg = TRUE;
16101 if ( n == INT_MIN ) { 16147 if ( n == LONG_MIN ) {
16102 // Cannot always negate this special case 16148 // Cannot always negate this special case
16103 QString s1, s2; 16149 QString s1, s2;
16104 s1.setNum(n/base); 16150 s1.setNum(n/base, base );
16105 s2.setNum((-(n+base))%base); 16151 s2.setNum((-(n+base))%base, base );
16106 *this = s1 + s2; 16152 *this = s1 + s2;
@@ -16463,2 +16509,11 @@ void QString::setExpand( uint index, QChar c )
16463 16509
16510/*! \fn QString& QString::append( const std::string &str )
16511 \overload
16512
16513 Appends \a str to the string and returns a reference to the result.
16514
16515 Equivalent to operator+=().
16516 */
16517
16518
16464/*! \fn QString& QString::append( const char *str ) 16519/*! \fn QString& QString::append( const char *str )
@@ -16492,2 +16547,3 @@ QString& QString::operator+=( const QString &str )
16492*/ 16547*/
16548#ifndef QT_NO_CAST_ASCII
16493QString& QString::operator+=( const char *str ) 16549QString& QString::operator+=( const char *str )
@@ -16495,2 +16551,7 @@ QString& QString::operator+=( const char *str )
16495 if ( str ) { 16551 if ( str ) {
16552#ifndef QT_NO_TEXTCODEC
16553 if ( QTextCodec::codecForCStrings() )
16554 return operator+=( fromAscii( str ) );
16555#endif
16556
16496 uint len1 = length(); 16557 uint len1 = length();
@@ -16510,2 +16571,3 @@ QString& QString::operator+=( const char *str )
16510} 16571}
16572#endif
16511 16573
@@ -16531,2 +16593,6 @@ QString &QString::operator+=( char c )
16531{ 16593{
16594#ifndef QT_NO_TEXTCODEC
16595 if ( QTextCodec::codecForCStrings() )
16596 return operator+=( fromAscii( &c, 1 ) );
16597#endif
16532 setLength(length()+1); 16598 setLength(length()+1);
@@ -16543,2 +16609,9 @@ QString &QString::operator+=( char c )
16543 16609
16610/*!
16611 \fn QString &QString::operator+=( const std::string &str )
16612 \overload
16613
16614 Appends \a str to the string and returns a reference to the string.
16615*/
16616
16544 16617
@@ -16548,4 +16621,4 @@ QString &QString::operator+=( char c )
16548 16621
16549 Returns a latin-1 copy of this character, if this character is in 16622 Returns the Latin-1 value of this character, or 0 if it
16550 the latin-1 character set. If not, this function returns 0. 16623 cannot be represented in Latin-1.
16551*/ 16624*/
@@ -16554,3 +16627,3 @@ QString &QString::operator+=( char c )
16554/*! 16627/*!
16555 Returns a Latin-1 representation of the string. Note that the 16628 Returns a Latin-1 representation of the string. The
16556 returned value is undefined if the string contains non-Latin-1 16629 returned value is undefined if the string contains non-Latin-1
@@ -16565,3 +16638,3 @@ QString &QString::operator+=( char c )
16565 16638
16566 \sa utf8(), local8Bit() 16639 \sa fromLatin1(), ascii(), utf8(), local8Bit()
16567*/ 16640*/
@@ -16569,6 +16642,5 @@ const char* QString::latin1() const
16569{ 16642{
16570 if ( !d->ascii ) { 16643 if ( !d->ascii || !d->islatin1 ) {
16571 Q2HELPER(stat_get_ascii++) 16644 d->ascii = unicodeToLatin1( d->unicode, d->len );
16572 Q2HELPER(stat_get_ascii_size+=d->len) 16645 d->islatin1 = TRUE;
16573 d->ascii = unicodeToAscii( d->unicode, d->len );
16574 } 16646 }
@@ -16578,10 +16650,29 @@ const char* QString::latin1() const
16578/*! 16650/*!
16579 \fn const char* QString::ascii() const 16651 Returns an 8-bit ASCII representation of the string.
16580 \obsolete
16581 16652
16582 This function simply calls latin1() and returns the result. 16653 If a codec has been set using QTextCodec::codecForCStrings(),
16654 it is used to convert Unicode to 8-bit char. Otherwise, this function
16655 does the same as latin1().
16656
16657 \sa fromAscii(), latin1(), utf8(), local8Bit()
16583*/ 16658*/
16659const char* QString::ascii() const
16660{
16661#ifndef QT_NO_TEXTCODEC
16662 if ( QTextCodec::codecForCStrings() ) {
16663 if ( !d->ascii || d->islatin1 ) {
16664 QCString s = QTextCodec::codecForCStrings()->fromUnicode( *this );
16665 s.detach();
16666 d->ascii = s.data();
16667 d->islatin1 = FALSE;
16668 s.resetRawData( s.data(), s.size() ); // we have stolen the data
16669 }
16670 return d->ascii;
16671 }
16672#endif // QT_NO_TEXTCODEC
16673 return latin1();
16674}
16584 16675
16585/*! 16676/*!
16586 Returns the string encoded in UTF8 format. 16677 Returns the string encoded in UTF-8 format.
16587 16678
@@ -16589,3 +16680,3 @@ const char* QString::latin1() const
16589 16680
16590 \sa QString::fromUtf8(), local8Bit(), latin1() 16681 \sa fromUtf8(), ascii(), latin1(), local8Bit()
16591*/ 16682*/
@@ -16635,3 +16726,4 @@ QString QString::fromUtf8( const char* utf8, int len )
16635 16726
16636 if ( len < 0 ) len = qstrlen( utf8 ); 16727 if ( len < 0 )
16728 len = strlen( utf8 );
16637 QString result; 16729 QString result;
@@ -16676,6 +16768,10 @@ QString QString::fromUtf8( const char* utf8, int len )
16676 Returns the Unicode string decoded from the first \a len 16768 Returns the Unicode string decoded from the first \a len
16677 characters of \a chars, ignoring the rest of \a chars. If \a len 16769 characters of \a ascii, ignoring the rest of \a ascii. If \a len
16678 is -1 then the length of \a chars is used. If \a len is bigger 16770 is -1 then the length of \a ascii is used. If \a len is bigger
16679 than the length of \a chars then it will use the length of \a 16771 than the length of \a ascii then it will use the length of \a
16680 chars. 16772 ascii.
16773
16774 If a codec has been set using QTextCodec::codecForCStrings(),
16775 it is used to convert Unicode to 8-bit char. Otherwise, this function
16776 does the same as fromLatin1().
16681 16777
@@ -16684,8 +16780,34 @@ QString QString::fromUtf8( const char* utf8, int len )
16684 \c QT_NO_CAST_ASCII, in which case you can explicitly create a 16780 \c QT_NO_CAST_ASCII, in which case you can explicitly create a
16685 QString from Latin-1 text using this function. 16781 QString from 8-bit ASCII text using this function.
16686 16782
16687 \code 16783 \code
16688 QString str = QString::fromLatin1( "123456789", 5 ); 16784 QString str = QString::fromAscii( "123456789", 5 );
16689 // str == "12345" 16785 // str == "12345"
16690 \endcode 16786 \endcode
16787 */
16788QString QString::fromAscii( const char* ascii, int len )
16789{
16790#ifndef QT_NO_TEXTCODEC
16791 if ( QTextCodec::codecForCStrings() ) {
16792 if ( !ascii )
16793 return QString::null;
16794 if ( len < 0 )
16795 len = strlen( ascii );
16796 if ( len == 0 || *ascii == '\0' )
16797 return QString::fromLatin1( "" );
16798 return QTextCodec::codecForCStrings()->toUnicode( ascii, len );
16799 }
16800#endif
16801 return fromLatin1( ascii, len );
16802}
16803
16804
16805/*!
16806 Returns the Unicode string decoded from the first \a len
16807 characters of \a chars, ignoring the rest of \a chars. If \a len
16808 is -1 then the length of \a chars is used. If \a len is bigger
16809 than the length of \a chars then it will use the length of \a
16810 chars.
16811
16812 \sa fromAscii()
16691*/ 16813*/
@@ -16697,3 +16819,3 @@ QString QString::fromLatin1( const char* chars, int len )
16697 len = -1; 16819 len = -1;
16698 uc = internalAsciiToUnicode( chars, &l, len ); 16820 uc = internalLatin1ToUnicode( chars, &l, len );
16699 return QString( new QStringData(uc, l, l), TRUE ); 16821 return QString( new QStringData(uc, l, l), TRUE );
@@ -16711,4 +16833,4 @@ QString QString::fromLatin1( const char* chars, int len )
16711 this is the QTextCodec::codecForLocale(). On Windows, it is a 16833 this is the QTextCodec::codecForLocale(). On Windows, it is a
16712 system-defined encoding. On Mac OS X, this always uses utf8 as the 16834 system-defined encoding. On Mac OS X, this always uses UTF-8 as
16713 encoding. 16835 the encoding.
16714 16836
@@ -16717,6 +16839,5 @@ QString QString::fromLatin1( const char* chars, int len )
16717 16839
16718 \sa QString::fromLocal8Bit(), latin1(), utf8() 16840 \sa fromLocal8Bit(), ascii(), latin1(), utf8()
16719*/ 16841*/
16720 16842
16721
16722QCString QString::local8Bit() const 16843QCString QString::local8Bit() const
@@ -16742,3 +16863,3 @@ QCString QString::local8Bit() const
16742#ifdef Q_WS_QWS 16863#ifdef Q_WS_QWS
16743 return utf8(); // ##### if there is ANY 8 bit format supported? 16864 return utf8(); // ### if there is any 8 bit format supported?
16744#endif 16865#endif
@@ -16773,3 +16894,4 @@ QString QString::fromLocal8Bit( const char* local8Bit, int len )
16773 QTextCodec* codec = QTextCodec::codecForLocale(); 16894 QTextCodec* codec = QTextCodec::codecForLocale();
16774 if ( len < 0 ) len = qstrlen(local8Bit); 16895 if ( len < 0 )
16896 len = strlen( local8Bit );
16775 return codec 16897 return codec
@@ -16806,2 +16928,8 @@ QString QString::fromLocal8Bit( const char* local8Bit, int len )
16806 16928
16929/*!
16930 \fn QString::operator std::string() const
16931
16932 Returns ascii().
16933*/
16934
16807 16935
@@ -16821,4 +16949,2 @@ const unsigned short *QString::ucs2() const
16821 // detach, grow or shrink 16949 // detach, grow or shrink
16822 Q2HELPER(stat_copy_on_write++)
16823 Q2HELPER(stat_copy_on_write_size += len)
16824 uint newMax = computeNewMax( len + 1 ); 16950 uint newMax = computeNewMax( len + 1 );
@@ -16985,4 +17111,2 @@ QString& QString::setUnicode( const QChar *unicode, uint len )
16985 // detach, grown or shrink 17111 // detach, grown or shrink
16986 Q2HELPER(stat_copy_on_write++)
16987 Q2HELPER(stat_copy_on_write_size+=d->len)
16988 uint newMax = computeNewMax( len ); 17112 uint newMax = computeNewMax( len );
@@ -17020,2 +17144,24 @@ QString& QString::setUnicodeCodes( const ushort* unicode_as_ushorts, uint len )
17020/*! 17144/*!
17145 Sets this string to \a str, interpreted as a classic 8-bit ASCII C
17146 string. If \a len is -1 (the default), then it is set to
17147 strlen(str).
17148
17149 If \a str is 0 a null string is created. If \a str is "", an empty
17150 string is created.
17151
17152 \sa isNull(), isEmpty()
17153*/
17154
17155QString &QString::setAscii( const char *str, int len )
17156{
17157#ifndef QT_NO_TEXTCODEC
17158 if ( QTextCodec::codecForCStrings() ) {
17159 *this = QString::fromAscii( str, len );
17160 return *this;
17161 }
17162#endif // QT_NO_TEXTCODEC
17163 return setLatin1( str, len );
17164}
17165
17166/*!
17021 Sets this string to \a str, interpreted as a classic Latin1 C 17167 Sets this string to \a str, interpreted as a classic Latin1 C
@@ -17035,3 +17181,3 @@ QString &QString::setLatin1( const char *str, int len )
17035 if ( len < 0 ) 17181 if ( len < 0 )
17036 len = qstrlen(str); 17182 len = strlen( str );
17037 if ( len == 0 ) { // won't make a null string 17183 if ( len == 0 ) { // won't make a null string
@@ -17053,3 +17199,2 @@ void QString::checkSimpleText() const
17053 QChar *end = p + d->len; 17199 QChar *end = p + d->len;
17054 d->simpletext = 1;
17055 while( p < end ) { 17200 while( p < end ) {
@@ -17058,3 +17203,3 @@ void QString::checkSimpleText() const
17058 if ( uc > 0x058f && ( uc < 0x1100 || uc > 0xfb0f ) ) { 17203 if ( uc > 0x058f && ( uc < 0x1100 || uc > 0xfb0f ) ) {
17059 d->simpletext = 0; 17204 d->issimpletext = FALSE;
17060 return; 17205 return;
@@ -17063,2 +17208,3 @@ void QString::checkSimpleText() const
17063 } 17208 }
17209 d->issimpletext = TRUE;
17064} 17210}
diff --git a/qmake/tools/qtextstream.cpp b/qmake/tools/qtextstream.cpp
index 75c6531..ddca5bd 100644
--- a/qmake/tools/qtextstream.cpp
+++ b/qmake/tools/qtextstream.cpp
@@ -1091,3 +1091,3 @@ QTextStream &QTextStream::writeBlock( const QChar* p, uint len )
1091 if ( latin1 ) { 1091 if ( latin1 ) {
1092 char *str = QString::unicodeToAscii( p, len ); 1092 char *str = QString::unicodeToLatin1( p, len );
1093 dev->writeBlock( str, len ); 1093 dev->writeBlock( str, len );
diff --git a/qmake/tools/qucom.cpp b/qmake/tools/qucom.cpp
index 6086a79..658da97 100644
--- a/qmake/tools/qucom.cpp
+++ b/qmake/tools/qucom.cpp
@@ -298,4 +298,3 @@ bool QUType_int::canConvertFrom( QUObject *o, QUType *t )
298{ 298{
299 if ( isEqual( t, &static_QUType_double ) || 299 if ( isEqual( t, &static_QUType_double ) )
300 isEqual( t, &static_QUType_float ) )
301 return TRUE; 300 return TRUE;
@@ -307,4 +306,3 @@ bool QUType_int::canConvertTo( QUObject * /*o*/, QUType *t )
307{ 306{
308 return isEqual( t, &static_QUType_double ) || 307 return isEqual( t, &static_QUType_double );
309 isEqual( t, &static_QUType_float );
310} 308}
@@ -315,4 +313,2 @@ bool QUType_int::convertFrom( QUObject *o, QUType *t )
315 o->payload.i = (long)o->payload.d; 313 o->payload.i = (long)o->payload.d;
316 else if ( isEqual( t, &static_QUType_float ) )
317 o->payload.i = (long)o->payload.f;
318 else 314 else
@@ -329,5 +325,2 @@ bool QUType_int::convertTo( QUObject *o, QUType *t )
329 o->type = &static_QUType_double; 325 o->type = &static_QUType_double;
330 } else if ( isEqual( t, &static_QUType_float ) ) {
331 o->payload.f = (float)o->payload.i;
332 o->type = &static_QUType_float;
333 } else 326 } else
@@ -347,44 +340,2 @@ int QUType_int::serializeFrom( QUObject *, QUBuffer * )
347 340
348// {5938712A-C496-11D5-8CB2-00C0F03BC0F3}
349const QUuid TID_QUType_uint( 0x5938712a, 0xc496, 0x11d5, 0x8c, 0xb2, 0x00, 0xc0, 0xf0, 0x3b, 0xc0, 0xf3);
350QUType_uint static_QUType_uint;
351const QUuid *QUType_uint::uuid() const { return &TID_QUType_uint; }
352const char *QUType_uint::desc() const { return "uint"; }
353
354void QUType_uint::set( QUObject *o, uint v )
355{
356 o->payload.ui = v;
357 o->type = this;
358}
359
360bool QUType_uint::canConvertFrom( QUObject *o, QUType *t )
361{
362 return t->canConvertTo( o, this );
363}
364
365bool QUType_uint::canConvertTo( QUObject * /*o*/, QUType * /*t*/ )
366{
367 return FALSE;
368}
369
370bool QUType_uint::convertFrom( QUObject *o, QUType *t )
371{
372 return t->convertTo( o, this );
373}
374
375bool QUType_uint::convertTo( QUObject * /*o*/, QUType * /*t*/ )
376{
377 return FALSE;
378}
379
380int QUType_uint::serializeTo( QUObject *, QUBuffer * )
381{
382 return 0;
383}
384
385int QUType_uint::serializeFrom( QUObject *, QUBuffer * )
386{
387 return 0;
388}
389
390// {2D0974E5-0BA6-4ec2-8837-C198972CB48C} 341// {2D0974E5-0BA6-4ec2-8837-C198972CB48C}
@@ -403,4 +354,3 @@ bool QUType_double::canConvertFrom( QUObject *o, QUType *t )
403{ 354{
404 if ( isEqual( t, &static_QUType_int ) || 355 if ( isEqual( t, &static_QUType_int ) )
405 isEqual( t, &static_QUType_float) )
406 return TRUE; 356 return TRUE;
@@ -412,4 +362,3 @@ bool QUType_double::canConvertTo( QUObject * /*o*/, QUType *t )
412{ 362{
413 return isEqual( t, &static_QUType_int ) || 363 return isEqual( t, &static_QUType_int );
414 isEqual( t, &static_QUType_float );
415} 364}
@@ -420,5 +369,3 @@ bool QUType_double::convertFrom( QUObject *o, QUType *t )
420 o->payload.d = (double)o->payload.i; 369 o->payload.d = (double)o->payload.i;
421 else if ( isEqual( t, &static_QUType_float ) ) 370 else
422 o->payload.d = (double)o->payload.f;
423 else
424 return t->convertTo( o, this ); 371 return t->convertTo( o, this );
@@ -452,66 +399,2 @@ int QUType_double::serializeFrom( QUObject *, QUBuffer * )
452 399
453
454// {544C5175-6993-4486-B04D-CEC4D21BF4B9 }
455const QUuid TID_QUType_float( 0x544c5175, 0x6993, 0x4486, 0xb0, 0x4d, 0xce, 0xc4, 0xd2, 0x1b, 0xf4, 0xb9 );
456QUType_float static_QUType_float;
457const QUuid *QUType_float::uuid() const { return &TID_QUType_float; }
458const char *QUType_float::desc() const {return "float"; }
459
460void QUType_float::set( QUObject *o, float v )
461{
462 o->payload.f = v;
463 o->type = this;
464}
465
466bool QUType_float::canConvertFrom( QUObject *o, QUType *t )
467{
468 if ( isEqual( t, &static_QUType_int ) ||
469 isEqual( t, &static_QUType_double ) )
470 return TRUE;
471
472 return t->canConvertTo( o, this );
473}
474
475bool QUType_float::canConvertTo( QUObject * /*o*/, QUType *t )
476{
477 return isEqual( t, &static_QUType_int ) ||
478 isEqual( t, &static_QUType_double );
479}
480
481bool QUType_float::convertFrom( QUObject *o, QUType *t )
482{
483 if ( isEqual( t, &static_QUType_int ) )
484 o->payload.f = (float)o->payload.i;
485 else if ( isEqual( t, &static_QUType_double ) )
486 o->payload.f = (float)o->payload.d;
487 else
488 return t->convertTo( o, this );
489
490 o->type = this;
491 return TRUE;
492}
493
494bool QUType_float::convertTo( QUObject *o, QUType *t )
495{
496 if ( isEqual( t, &static_QUType_int ) ) {
497 o->payload.i = (int) o->payload.f;
498 o->type = &static_QUType_int;
499 } else if ( isEqual( t, &static_QUType_double ) ) {
500 o->payload.d = (double) o->payload.f;
501 o->type = &static_QUType_double;
502 } else
503 return FALSE;
504 return TRUE;
505}
506
507int QUType_float::serializeTo( QUObject *, QUBuffer * )
508{
509 return 0;
510}
511
512int QUType_float::serializeFrom( QUObject *, QUBuffer * )
513{
514 return 0;
515}
516
517// {EFCDD1D4-77A3-4b8e-8D46-DC14B8D393E9} 400// {EFCDD1D4-77A3-4b8e-8D46-DC14B8D393E9}
@@ -595,3 +478,2 @@ bool QUType_QString::canConvertFrom( QUObject *o, QUType *t )
595 isEqual( t, &static_QUType_double ) || 478 isEqual( t, &static_QUType_double ) ||
596 isEqual( t, &static_QUType_float ) ||
597 isEqual( t, &static_QUType_int ) ) 479 isEqual( t, &static_QUType_int ) )
@@ -606,4 +488,3 @@ bool QUType_QString::canConvertTo( QUObject * /*o*/, QUType *t )
606 isEqual( t, &static_QUType_int ) || 488 isEqual( t, &static_QUType_int ) ||
607 isEqual( t, &static_QUType_double ) || 489 isEqual( t, &static_QUType_double );
608 isEqual( t, &static_QUType_float );
609} 490}
@@ -617,4 +498,2 @@ bool QUType_QString::convertFrom( QUObject *o, QUType *t )
617 str = new QString( QString::number( o->payload.d ) ); 498 str = new QString( QString::number( o->payload.d ) );
618 else if ( isEqual( t, &static_QUType_float ) )
619 str = new QString( QString::number( o->payload.f ) );
620 else if ( isEqual( t, &static_QUType_int ) ) 499 else if ( isEqual( t, &static_QUType_int ) )
@@ -643,5 +522,2 @@ bool QUType_QString::convertTo( QUObject *o, QUType *t )
643 o->type = &static_QUType_double; 522 o->type = &static_QUType_double;
644 } else if ( isEqual( t, &static_QUType_float ) ) {
645 o->payload.d = str->toFloat();
646 o->type = &static_QUType_float;
647 } else { 523 } else {
diff --git a/qmake/tools/qwaitcondition_unix.cpp b/qmake/tools/qwaitcondition_unix.cpp
index 99c1014..6684617 100644
--- a/qmake/tools/qwaitcondition_unix.cpp
+++ b/qmake/tools/qwaitcondition_unix.cpp
@@ -126,3 +126,3 @@ struct QWaitConditionPrivate {
126 // Sleep until there are no busy worker threads 126 // Sleep until there are no busy worker threads
127 while( count > 0 ) { 127 while( mycount > 0 ) {
128 mymutex.unlock(); 128 mymutex.unlock();
@@ -226,3 +226,5 @@ bool QWaitCondition::wait(unsigned long time)
226{ 226{
227 pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; 227 pthread_mutex_t mutex;
228 pthread_mutex_init( &mutex, 0 );
229 pthread_mutex_lock( &mutex );
228 230
@@ -234,3 +236,3 @@ bool QWaitCondition::wait(unsigned long time)
234 timespec ti; 236 timespec ti;
235 ti.tv_nsec = (tv.tv_usec * 1000) + (time % 1000) * 1000; 237 ti.tv_nsec = ( tv.tv_usec + ( time % 1000 ) * 1000 ) * 1000;
236 ti.tv_sec = tv.tv_sec + (time / 1000) + ( ti.tv_nsec / 1000000000 ); 238 ti.tv_sec = tv.tv_sec + (time / 1000) + ( ti.tv_nsec / 1000000000 );
@@ -247,2 +249,5 @@ bool QWaitCondition::wait(unsigned long time)
247 249
250 pthread_mutex_unlock( &mutex );
251 pthread_mutex_destroy( &mutex );
252
248 return (ret == 0); 253 return (ret == 0);
@@ -293,3 +298,3 @@ bool QWaitCondition::wait(QMutex *mutex, unsigned long time)
293 timespec ti; 298 timespec ti;
294 ti.tv_nsec = (tv.tv_usec * 1000) + (time % 1000) * 1000; 299 ti.tv_nsec = ( tv.tv_usec + ( time % 1000 ) * 1000 ) * 1000;
295 ti.tv_sec = tv.tv_sec + (time / 1000) + ( ti.tv_nsec / 1000000000 ); 300 ti.tv_sec = tv.tv_sec + (time / 1000) + ( ti.tv_nsec / 1000000000 );