|
|
@ -46,9 +46,9 @@
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
// WARNING
|
|
|
|
// WARNING
|
|
|
|
// When MAKE_TQSTRING_THREAD_SAFE is defined, overall TQt3 performance suffers badly!
|
|
|
|
// When MAKE_QSTRING_THREAD_SAFE is defined, overall TQt3 performance suffers badly!
|
|
|
|
// TQString is thread unsafe in many other areas; perhaps this option is not even useful?
|
|
|
|
// TQString is thread unsafe in many other areas; perhaps this option is not even useful?
|
|
|
|
// #define MAKE_TQSTRING_THREAD_SAFE 1
|
|
|
|
// #define MAKE_QSTRING_THREAD_SAFE 1
|
|
|
|
|
|
|
|
|
|
|
|
#include "ntqstring.h"
|
|
|
|
#include "ntqstring.h"
|
|
|
|
#include "ntqregexp.h"
|
|
|
|
#include "ntqregexp.h"
|
|
|
@ -93,9 +93,9 @@
|
|
|
|
#define ULLONG_MAX TQ_UINT64_C(18446744073709551615)
|
|
|
|
#define ULLONG_MAX TQ_UINT64_C(18446744073709551615)
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
#if defined(QT_THREAD_SUPPORT) && defined(MAKE_TQSTRING_THREAD_SAFE)
|
|
|
|
#if defined(QT_THREAD_SUPPORT) && defined(MAKE_QSTRING_THREAD_SAFE)
|
|
|
|
#include "ntqmutex.h"
|
|
|
|
#include "ntqmutex.h"
|
|
|
|
#endif // QT_THREAD_SUPPORT && MAKE_TQSTRING_THREAD_SAFE
|
|
|
|
#endif // QT_THREAD_SUPPORT && MAKE_QSTRING_THREAD_SAFE
|
|
|
|
|
|
|
|
|
|
|
|
extern TQMutex *tqt_sharedStringMutex;
|
|
|
|
extern TQMutex *tqt_sharedStringMutex;
|
|
|
|
|
|
|
|
|
|
|
@ -1053,9 +1053,9 @@ TQStringData::TQStringData() : TQShared(),
|
|
|
|
maxl(0),
|
|
|
|
maxl(0),
|
|
|
|
islatin1(FALSE),
|
|
|
|
islatin1(FALSE),
|
|
|
|
security_unpaged(FALSE) {
|
|
|
|
security_unpaged(FALSE) {
|
|
|
|
#if defined(QT_THREAD_SUPPORT) && defined(MAKE_TQSTRING_THREAD_SAFE)
|
|
|
|
#if defined(QT_THREAD_SUPPORT) && defined(MAKE_QSTRING_THREAD_SAFE)
|
|
|
|
mutex = new TQMutex(FALSE);
|
|
|
|
mutex = new TQMutex(FALSE);
|
|
|
|
#endif // QT_THREAD_SUPPORT && MAKE_TQSTRING_THREAD_SAFE
|
|
|
|
#endif // QT_THREAD_SUPPORT && MAKE_QSTRING_THREAD_SAFE
|
|
|
|
ref();
|
|
|
|
ref();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -1067,9 +1067,9 @@ TQStringData::TQStringData(TQChar *u, uint l, uint m) : TQShared(),
|
|
|
|
maxl(m),
|
|
|
|
maxl(m),
|
|
|
|
islatin1(FALSE),
|
|
|
|
islatin1(FALSE),
|
|
|
|
security_unpaged(FALSE) {
|
|
|
|
security_unpaged(FALSE) {
|
|
|
|
#if defined(QT_THREAD_SUPPORT) && defined(MAKE_TQSTRING_THREAD_SAFE)
|
|
|
|
#if defined(QT_THREAD_SUPPORT) && defined(MAKE_QSTRING_THREAD_SAFE)
|
|
|
|
mutex = new TQMutex(FALSE);
|
|
|
|
mutex = new TQMutex(FALSE);
|
|
|
|
#endif // QT_THREAD_SUPPORT && MAKE_TQSTRING_THREAD_SAFE
|
|
|
|
#endif // QT_THREAD_SUPPORT && MAKE_QSTRING_THREAD_SAFE
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
TQStringData::~TQStringData() {
|
|
|
|
TQStringData::~TQStringData() {
|
|
|
@ -1084,12 +1084,12 @@ TQStringData::~TQStringData() {
|
|
|
|
if ( ascii ) {
|
|
|
|
if ( ascii ) {
|
|
|
|
delete[] ascii;
|
|
|
|
delete[] ascii;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#if defined(QT_THREAD_SUPPORT) && defined(MAKE_TQSTRING_THREAD_SAFE)
|
|
|
|
#if defined(QT_THREAD_SUPPORT) && defined(MAKE_QSTRING_THREAD_SAFE)
|
|
|
|
if ( mutex ) {
|
|
|
|
if ( mutex ) {
|
|
|
|
delete mutex;
|
|
|
|
delete mutex;
|
|
|
|
mutex = NULL;
|
|
|
|
mutex = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif // QT_THREAD_SUPPORT && MAKE_TQSTRING_THREAD_SAFE
|
|
|
|
#endif // QT_THREAD_SUPPORT && MAKE_QSTRING_THREAD_SAFE
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void TQStringData::setDirty() {
|
|
|
|
void TQStringData::setDirty() {
|
|
|
@ -1457,14 +1457,14 @@ QT_STATIC_CONST_IMPL TQChar TQChar::nbsp((ushort)0x00a0);
|
|
|
|
|
|
|
|
|
|
|
|
TQStringData* TQString::makeSharedNull()
|
|
|
|
TQStringData* TQString::makeSharedNull()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
#if defined(QT_THREAD_SUPPORT) && defined(MAKE_TQSTRING_THREAD_SAFE)
|
|
|
|
#if defined(QT_THREAD_SUPPORT) && defined(MAKE_QSTRING_THREAD_SAFE)
|
|
|
|
if (tqt_sharedStringMutex) tqt_sharedStringMutex->lock();
|
|
|
|
if (tqt_sharedStringMutex) tqt_sharedStringMutex->lock();
|
|
|
|
#endif // QT_THREAD_SUPPORT && MAKE_TQSTRING_THREAD_SAFE
|
|
|
|
#endif // QT_THREAD_SUPPORT && MAKE_QSTRING_THREAD_SAFE
|
|
|
|
|
|
|
|
|
|
|
|
if (TQString::shared_null) {
|
|
|
|
if (TQString::shared_null) {
|
|
|
|
#if defined(QT_THREAD_SUPPORT) && defined(MAKE_TQSTRING_THREAD_SAFE)
|
|
|
|
#if defined(QT_THREAD_SUPPORT) && defined(MAKE_QSTRING_THREAD_SAFE)
|
|
|
|
if (tqt_sharedStringMutex) tqt_sharedStringMutex->unlock();
|
|
|
|
if (tqt_sharedStringMutex) tqt_sharedStringMutex->unlock();
|
|
|
|
#endif // QT_THREAD_SUPPORT && MAKE_TQSTRING_THREAD_SAFE
|
|
|
|
#endif // QT_THREAD_SUPPORT && MAKE_QSTRING_THREAD_SAFE
|
|
|
|
return TQString::shared_null;
|
|
|
|
return TQString::shared_null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -1474,9 +1474,9 @@ TQStringData* TQString::makeSharedNull()
|
|
|
|
that->d = TQString::shared_null;
|
|
|
|
that->d = TQString::shared_null;
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
#if defined(QT_THREAD_SUPPORT) && defined(MAKE_TQSTRING_THREAD_SAFE)
|
|
|
|
#if defined(QT_THREAD_SUPPORT) && defined(MAKE_QSTRING_THREAD_SAFE)
|
|
|
|
if (tqt_sharedStringMutex) tqt_sharedStringMutex->unlock();
|
|
|
|
if (tqt_sharedStringMutex) tqt_sharedStringMutex->unlock();
|
|
|
|
#endif // QT_THREAD_SUPPORT && MAKE_TQSTRING_THREAD_SAFE
|
|
|
|
#endif // QT_THREAD_SUPPORT && MAKE_QSTRING_THREAD_SAFE
|
|
|
|
return TQString::shared_null;
|
|
|
|
return TQString::shared_null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -1517,13 +1517,13 @@ TQString::TQString( const TQString &s ) :
|
|
|
|
d(s.d)
|
|
|
|
d(s.d)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if ( d && (d != shared_null) ) {
|
|
|
|
if ( d && (d != shared_null) ) {
|
|
|
|
#if defined(QT_THREAD_SUPPORT) && defined(MAKE_TQSTRING_THREAD_SAFE)
|
|
|
|
#if defined(QT_THREAD_SUPPORT) && defined(MAKE_QSTRING_THREAD_SAFE)
|
|
|
|
d->mutex->lock();
|
|
|
|
d->mutex->lock();
|
|
|
|
#endif // QT_THREAD_SUPPORT && MAKE_TQSTRING_THREAD_SAFE
|
|
|
|
#endif // QT_THREAD_SUPPORT && MAKE_QSTRING_THREAD_SAFE
|
|
|
|
d->ref();
|
|
|
|
d->ref();
|
|
|
|
#if defined(QT_THREAD_SUPPORT) && defined(MAKE_TQSTRING_THREAD_SAFE)
|
|
|
|
#if defined(QT_THREAD_SUPPORT) && defined(MAKE_QSTRING_THREAD_SAFE)
|
|
|
|
d->mutex->unlock();
|
|
|
|
d->mutex->unlock();
|
|
|
|
#endif // QT_THREAD_SUPPORT && MAKE_TQSTRING_THREAD_SAFE
|
|
|
|
#endif // QT_THREAD_SUPPORT && MAKE_QSTRING_THREAD_SAFE
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -1676,20 +1676,20 @@ TQString::~TQString()
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#if defined(QT_THREAD_SUPPORT) && defined(MAKE_TQSTRING_THREAD_SAFE)
|
|
|
|
#if defined(QT_THREAD_SUPPORT) && defined(MAKE_QSTRING_THREAD_SAFE)
|
|
|
|
d->mutex->lock();
|
|
|
|
d->mutex->lock();
|
|
|
|
#endif // QT_THREAD_SUPPORT && MAKE_TQSTRING_THREAD_SAFE
|
|
|
|
#endif // QT_THREAD_SUPPORT && MAKE_QSTRING_THREAD_SAFE
|
|
|
|
if ( d->deref() ) {
|
|
|
|
if ( d->deref() ) {
|
|
|
|
#if defined(QT_THREAD_SUPPORT) && defined(MAKE_TQSTRING_THREAD_SAFE)
|
|
|
|
#if defined(QT_THREAD_SUPPORT) && defined(MAKE_QSTRING_THREAD_SAFE)
|
|
|
|
d->mutex->unlock();
|
|
|
|
d->mutex->unlock();
|
|
|
|
#endif // QT_THREAD_SUPPORT && MAKE_TQSTRING_THREAD_SAFE
|
|
|
|
#endif // QT_THREAD_SUPPORT && MAKE_QSTRING_THREAD_SAFE
|
|
|
|
d->deleteSelf();
|
|
|
|
d->deleteSelf();
|
|
|
|
d = NULL;
|
|
|
|
d = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
else {
|
|
|
|
#if defined(QT_THREAD_SUPPORT) && defined(MAKE_TQSTRING_THREAD_SAFE)
|
|
|
|
#if defined(QT_THREAD_SUPPORT) && defined(MAKE_QSTRING_THREAD_SAFE)
|
|
|
|
d->mutex->unlock();
|
|
|
|
d->mutex->unlock();
|
|
|
|
#endif // QT_THREAD_SUPPORT && MAKE_TQSTRING_THREAD_SAFE
|
|
|
|
#endif // QT_THREAD_SUPPORT && MAKE_QSTRING_THREAD_SAFE
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -1711,22 +1711,22 @@ void TQString::real_detach()
|
|
|
|
void TQString::deref()
|
|
|
|
void TQString::deref()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if ( d && (d != shared_null) ) {
|
|
|
|
if ( d && (d != shared_null) ) {
|
|
|
|
#if defined(QT_THREAD_SUPPORT) && defined(MAKE_TQSTRING_THREAD_SAFE)
|
|
|
|
#if defined(QT_THREAD_SUPPORT) && defined(MAKE_QSTRING_THREAD_SAFE)
|
|
|
|
d->mutex->lock();
|
|
|
|
d->mutex->lock();
|
|
|
|
#endif // QT_THREAD_SUPPORT && MAKE_TQSTRING_THREAD_SAFE
|
|
|
|
#endif // QT_THREAD_SUPPORT && MAKE_QSTRING_THREAD_SAFE
|
|
|
|
if ( d->deref() ) {
|
|
|
|
if ( d->deref() ) {
|
|
|
|
#if defined(QT_THREAD_SUPPORT) && defined(MAKE_TQSTRING_THREAD_SAFE)
|
|
|
|
#if defined(QT_THREAD_SUPPORT) && defined(MAKE_QSTRING_THREAD_SAFE)
|
|
|
|
d->mutex->unlock();
|
|
|
|
d->mutex->unlock();
|
|
|
|
#endif // QT_THREAD_SUPPORT && MAKE_TQSTRING_THREAD_SAFE
|
|
|
|
#endif // QT_THREAD_SUPPORT && MAKE_QSTRING_THREAD_SAFE
|
|
|
|
if ( d != shared_null ) {
|
|
|
|
if ( d != shared_null ) {
|
|
|
|
delete d;
|
|
|
|
delete d;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
d = 0;
|
|
|
|
d = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
else {
|
|
|
|
#if defined(QT_THREAD_SUPPORT) && defined(MAKE_TQSTRING_THREAD_SAFE)
|
|
|
|
#if defined(QT_THREAD_SUPPORT) && defined(MAKE_QSTRING_THREAD_SAFE)
|
|
|
|
d->mutex->unlock();
|
|
|
|
d->mutex->unlock();
|
|
|
|
#endif // QT_THREAD_SUPPORT && MAKE_TQSTRING_THREAD_SAFE
|
|
|
|
#endif // QT_THREAD_SUPPORT && MAKE_QSTRING_THREAD_SAFE
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -1769,13 +1769,13 @@ void TQStringData::deleteSelf()
|
|
|
|
TQString &TQString::operator=( const TQString &s )
|
|
|
|
TQString &TQString::operator=( const TQString &s )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if ( s.d && (s.d != shared_null) ) {
|
|
|
|
if ( s.d && (s.d != shared_null) ) {
|
|
|
|
#if defined(QT_THREAD_SUPPORT) && defined(MAKE_TQSTRING_THREAD_SAFE)
|
|
|
|
#if defined(QT_THREAD_SUPPORT) && defined(MAKE_QSTRING_THREAD_SAFE)
|
|
|
|
s.d->mutex->lock();
|
|
|
|
s.d->mutex->lock();
|
|
|
|
#endif // QT_THREAD_SUPPORT && MAKE_TQSTRING_THREAD_SAFE
|
|
|
|
#endif // QT_THREAD_SUPPORT && MAKE_QSTRING_THREAD_SAFE
|
|
|
|
s.d->ref();
|
|
|
|
s.d->ref();
|
|
|
|
#if defined(QT_THREAD_SUPPORT) && defined(MAKE_TQSTRING_THREAD_SAFE)
|
|
|
|
#if defined(QT_THREAD_SUPPORT) && defined(MAKE_QSTRING_THREAD_SAFE)
|
|
|
|
s.d->mutex->unlock();
|
|
|
|
s.d->mutex->unlock();
|
|
|
|
#endif // QT_THREAD_SUPPORT && MAKE_TQSTRING_THREAD_SAFE
|
|
|
|
#endif // QT_THREAD_SUPPORT && MAKE_QSTRING_THREAD_SAFE
|
|
|
|
}
|
|
|
|
}
|
|
|
|
deref();
|
|
|
|
deref();
|
|
|
|
d = s.d;
|
|
|
|
d = s.d;
|
|
|
@ -1883,9 +1883,9 @@ void TQString::truncate( uint newLen )
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
void TQString::setLength( uint newLen )
|
|
|
|
void TQString::setLength( uint newLen )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
#if defined(QT_THREAD_SUPPORT) && defined(MAKE_TQSTRING_THREAD_SAFE)
|
|
|
|
#if defined(QT_THREAD_SUPPORT) && defined(MAKE_QSTRING_THREAD_SAFE)
|
|
|
|
d->mutex->lock();
|
|
|
|
d->mutex->lock();
|
|
|
|
#endif // QT_THREAD_SUPPORT && MAKE_TQSTRING_THREAD_SAFE
|
|
|
|
#endif // QT_THREAD_SUPPORT && MAKE_QSTRING_THREAD_SAFE
|
|
|
|
|
|
|
|
|
|
|
|
if ( d->count != 1 || newLen > d->maxl ||
|
|
|
|
if ( d->count != 1 || newLen > d->maxl ||
|
|
|
|
( newLen * 4 < d->maxl && d->maxl > 4 ) ) {
|
|
|
|
( newLen * 4 < d->maxl && d->maxl > 4 ) ) {
|
|
|
@ -1896,24 +1896,24 @@ void TQString::setLength( uint newLen )
|
|
|
|
uint len = TQMIN( d->len, newLen );
|
|
|
|
uint len = TQMIN( d->len, newLen );
|
|
|
|
memcpy( nd, d->unicode, sizeof(TQChar) * len );
|
|
|
|
memcpy( nd, d->unicode, sizeof(TQChar) * len );
|
|
|
|
bool unpaged = d->security_unpaged;
|
|
|
|
bool unpaged = d->security_unpaged;
|
|
|
|
#if defined(QT_THREAD_SUPPORT) && defined(MAKE_TQSTRING_THREAD_SAFE)
|
|
|
|
#if defined(QT_THREAD_SUPPORT) && defined(MAKE_QSTRING_THREAD_SAFE)
|
|
|
|
d->mutex->unlock();
|
|
|
|
d->mutex->unlock();
|
|
|
|
#endif // QT_THREAD_SUPPORT && MAKE_TQSTRING_THREAD_SAFE
|
|
|
|
#endif // QT_THREAD_SUPPORT && MAKE_QSTRING_THREAD_SAFE
|
|
|
|
deref();
|
|
|
|
deref();
|
|
|
|
d = new TQStringData( nd, newLen, newMax );
|
|
|
|
d = new TQStringData( nd, newLen, newMax );
|
|
|
|
setSecurityUnPaged(unpaged);
|
|
|
|
setSecurityUnPaged(unpaged);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
else {
|
|
|
|
#if defined(QT_THREAD_SUPPORT) && defined(MAKE_TQSTRING_THREAD_SAFE)
|
|
|
|
#if defined(QT_THREAD_SUPPORT) && defined(MAKE_QSTRING_THREAD_SAFE)
|
|
|
|
d->mutex->unlock();
|
|
|
|
d->mutex->unlock();
|
|
|
|
#endif // QT_THREAD_SUPPORT && MAKE_TQSTRING_THREAD_SAFE
|
|
|
|
#endif // QT_THREAD_SUPPORT && MAKE_QSTRING_THREAD_SAFE
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
else {
|
|
|
|
d->len = newLen;
|
|
|
|
d->len = newLen;
|
|
|
|
#if defined(QT_THREAD_SUPPORT) && defined(MAKE_TQSTRING_THREAD_SAFE)
|
|
|
|
#if defined(QT_THREAD_SUPPORT) && defined(MAKE_QSTRING_THREAD_SAFE)
|
|
|
|
d->mutex->unlock();
|
|
|
|
d->mutex->unlock();
|
|
|
|
#endif // QT_THREAD_SUPPORT && MAKE_TQSTRING_THREAD_SAFE
|
|
|
|
#endif // QT_THREAD_SUPPORT && MAKE_QSTRING_THREAD_SAFE
|
|
|
|
d->setDirty();
|
|
|
|
d->setDirty();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -1999,21 +1999,21 @@ void TQString::squeeze()
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
void TQString::grow( uint newLen )
|
|
|
|
void TQString::grow( uint newLen )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
#if defined(QT_THREAD_SUPPORT) && defined(MAKE_TQSTRING_THREAD_SAFE)
|
|
|
|
#if defined(QT_THREAD_SUPPORT) && defined(MAKE_QSTRING_THREAD_SAFE)
|
|
|
|
d->mutex->lock();
|
|
|
|
d->mutex->lock();
|
|
|
|
#endif // QT_THREAD_SUPPORT && MAKE_TQSTRING_THREAD_SAFE
|
|
|
|
#endif // QT_THREAD_SUPPORT && MAKE_QSTRING_THREAD_SAFE
|
|
|
|
|
|
|
|
|
|
|
|
if ( d->count != 1 || newLen > d->maxl ) {
|
|
|
|
if ( d->count != 1 || newLen > d->maxl ) {
|
|
|
|
#if defined(QT_THREAD_SUPPORT) && defined(MAKE_TQSTRING_THREAD_SAFE)
|
|
|
|
#if defined(QT_THREAD_SUPPORT) && defined(MAKE_QSTRING_THREAD_SAFE)
|
|
|
|
d->mutex->unlock();
|
|
|
|
d->mutex->unlock();
|
|
|
|
#endif // QT_THREAD_SUPPORT && MAKE_TQSTRING_THREAD_SAFE
|
|
|
|
#endif // QT_THREAD_SUPPORT && MAKE_QSTRING_THREAD_SAFE
|
|
|
|
setLength( newLen );
|
|
|
|
setLength( newLen );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
else {
|
|
|
|
d->len = newLen;
|
|
|
|
d->len = newLen;
|
|
|
|
#if defined(QT_THREAD_SUPPORT) && defined(MAKE_TQSTRING_THREAD_SAFE)
|
|
|
|
#if defined(QT_THREAD_SUPPORT) && defined(MAKE_QSTRING_THREAD_SAFE)
|
|
|
|
d->mutex->unlock();
|
|
|
|
d->mutex->unlock();
|
|
|
|
#endif // QT_THREAD_SUPPORT && MAKE_TQSTRING_THREAD_SAFE
|
|
|
|
#endif // QT_THREAD_SUPPORT && MAKE_QSTRING_THREAD_SAFE
|
|
|
|
d->setDirty();
|
|
|
|
d->setDirty();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -6423,19 +6423,19 @@ TQString TQString::fromUcs2( const unsigned short *str )
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
TQChar& TQString::ref(uint i) {
|
|
|
|
TQChar& TQString::ref(uint i) {
|
|
|
|
#if defined(QT_THREAD_SUPPORT) && defined(MAKE_TQSTRING_THREAD_SAFE)
|
|
|
|
#if defined(QT_THREAD_SUPPORT) && defined(MAKE_QSTRING_THREAD_SAFE)
|
|
|
|
d->mutex->lock();
|
|
|
|
d->mutex->lock();
|
|
|
|
#endif // QT_THREAD_SUPPORT && MAKE_TQSTRING_THREAD_SAFE
|
|
|
|
#endif // QT_THREAD_SUPPORT && MAKE_QSTRING_THREAD_SAFE
|
|
|
|
if ( (d->count != 1) || (i >= d->len) ) {
|
|
|
|
if ( (d->count != 1) || (i >= d->len) ) {
|
|
|
|
#if defined(QT_THREAD_SUPPORT) && defined(MAKE_TQSTRING_THREAD_SAFE)
|
|
|
|
#if defined(QT_THREAD_SUPPORT) && defined(MAKE_QSTRING_THREAD_SAFE)
|
|
|
|
d->mutex->unlock();
|
|
|
|
d->mutex->unlock();
|
|
|
|
#endif // QT_THREAD_SUPPORT && MAKE_TQSTRING_THREAD_SAFE
|
|
|
|
#endif // QT_THREAD_SUPPORT && MAKE_QSTRING_THREAD_SAFE
|
|
|
|
subat( i );
|
|
|
|
subat( i );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
else {
|
|
|
|
#if defined(QT_THREAD_SUPPORT) && defined(MAKE_TQSTRING_THREAD_SAFE)
|
|
|
|
#if defined(QT_THREAD_SUPPORT) && defined(MAKE_QSTRING_THREAD_SAFE)
|
|
|
|
d->mutex->unlock();
|
|
|
|
d->mutex->unlock();
|
|
|
|
#endif // QT_THREAD_SUPPORT && MAKE_TQSTRING_THREAD_SAFE
|
|
|
|
#endif // QT_THREAD_SUPPORT && MAKE_QSTRING_THREAD_SAFE
|
|
|
|
}
|
|
|
|
}
|
|
|
|
d->setDirty();
|
|
|
|
d->setDirty();
|
|
|
|
return d->unicode[i];
|
|
|
|
return d->unicode[i];
|
|
|
@ -6523,9 +6523,9 @@ TQString& TQString::setUnicode( const TQChar *unicode, uint len )
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
else {
|
|
|
|
#if defined(QT_THREAD_SUPPORT) && defined(MAKE_TQSTRING_THREAD_SAFE)
|
|
|
|
#if defined(QT_THREAD_SUPPORT) && defined(MAKE_QSTRING_THREAD_SAFE)
|
|
|
|
d->mutex->lock();
|
|
|
|
d->mutex->lock();
|
|
|
|
#endif // QT_THREAD_SUPPORT && MAKE_TQSTRING_THREAD_SAFE
|
|
|
|
#endif // QT_THREAD_SUPPORT && MAKE_QSTRING_THREAD_SAFE
|
|
|
|
if ( d->count != 1 || len > d->maxl || ( len * 4 < d->maxl && d->maxl > 4 ) ) {
|
|
|
|
if ( d->count != 1 || len > d->maxl || ( len * 4 < d->maxl && d->maxl > 4 ) ) {
|
|
|
|
// detach, grown or shrink
|
|
|
|
// detach, grown or shrink
|
|
|
|
uint newMax = computeNewMax( len );
|
|
|
|
uint newMax = computeNewMax( len );
|
|
|
@ -6533,17 +6533,17 @@ TQString& TQString::setUnicode( const TQChar *unicode, uint len )
|
|
|
|
if ( unicode ) {
|
|
|
|
if ( unicode ) {
|
|
|
|
memcpy( nd, unicode, sizeof(TQChar)*len );
|
|
|
|
memcpy( nd, unicode, sizeof(TQChar)*len );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#if defined(QT_THREAD_SUPPORT) && defined(MAKE_TQSTRING_THREAD_SAFE)
|
|
|
|
#if defined(QT_THREAD_SUPPORT) && defined(MAKE_QSTRING_THREAD_SAFE)
|
|
|
|
d->mutex->unlock();
|
|
|
|
d->mutex->unlock();
|
|
|
|
#endif // QT_THREAD_SUPPORT && MAKE_TQSTRING_THREAD_SAFE
|
|
|
|
#endif // QT_THREAD_SUPPORT && MAKE_QSTRING_THREAD_SAFE
|
|
|
|
deref();
|
|
|
|
deref();
|
|
|
|
d = new TQStringData( nd, len, newMax );
|
|
|
|
d = new TQStringData( nd, len, newMax );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
else {
|
|
|
|
d->len = len;
|
|
|
|
d->len = len;
|
|
|
|
#if defined(QT_THREAD_SUPPORT) && defined(MAKE_TQSTRING_THREAD_SAFE)
|
|
|
|
#if defined(QT_THREAD_SUPPORT) && defined(MAKE_QSTRING_THREAD_SAFE)
|
|
|
|
d->mutex->unlock();
|
|
|
|
d->mutex->unlock();
|
|
|
|
#endif // QT_THREAD_SUPPORT && MAKE_TQSTRING_THREAD_SAFE
|
|
|
|
#endif // QT_THREAD_SUPPORT && MAKE_QSTRING_THREAD_SAFE
|
|
|
|
d->setDirty();
|
|
|
|
d->setDirty();
|
|
|
|
if ( unicode ) {
|
|
|
|
if ( unicode ) {
|
|
|
|
memcpy( d->unicode, unicode, sizeof(TQChar)*len );
|
|
|
|
memcpy( d->unicode, unicode, sizeof(TQChar)*len );
|
|
|
@ -7254,9 +7254,9 @@ TQConstString::TQConstString( const TQChar* unicode, uint length ) :
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
TQConstString::~TQConstString()
|
|
|
|
TQConstString::~TQConstString()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
#if defined(QT_THREAD_SUPPORT) && defined(MAKE_TQSTRING_THREAD_SAFE)
|
|
|
|
#if defined(QT_THREAD_SUPPORT) && defined(MAKE_QSTRING_THREAD_SAFE)
|
|
|
|
d->mutex->lock();
|
|
|
|
d->mutex->lock();
|
|
|
|
#endif // QT_THREAD_SUPPORT && MAKE_TQSTRING_THREAD_SAFE
|
|
|
|
#endif // QT_THREAD_SUPPORT && MAKE_QSTRING_THREAD_SAFE
|
|
|
|
|
|
|
|
|
|
|
|
if ( d->count > 1 ) {
|
|
|
|
if ( d->count > 1 ) {
|
|
|
|
TQChar* cp = QT_ALLOC_QCHAR_VEC( d->len );
|
|
|
|
TQChar* cp = QT_ALLOC_QCHAR_VEC( d->len );
|
|
|
@ -7268,9 +7268,9 @@ TQConstString::~TQConstString()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// The original d->unicode is now unlinked.
|
|
|
|
// The original d->unicode is now unlinked.
|
|
|
|
#if defined(QT_THREAD_SUPPORT) && defined(MAKE_TQSTRING_THREAD_SAFE)
|
|
|
|
#if defined(QT_THREAD_SUPPORT) && defined(MAKE_QSTRING_THREAD_SAFE)
|
|
|
|
d->mutex->unlock();
|
|
|
|
d->mutex->unlock();
|
|
|
|
#endif // QT_THREAD_SUPPORT && MAKE_TQSTRING_THREAD_SAFE
|
|
|
|
#endif // QT_THREAD_SUPPORT && MAKE_QSTRING_THREAD_SAFE
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
/*!
|
|
|
|