diff options
Diffstat (limited to 'src/tools/qstring.cpp')
-rw-r--r-- | src/tools/qstring.cpp | 45 |
1 files changed, 27 insertions, 18 deletions
diff --git a/src/tools/qstring.cpp b/src/tools/qstring.cpp index 143f80c..f9f3faa 100644 --- a/src/tools/qstring.cpp +++ b/src/tools/qstring.cpp @@ -576,7 +576,7 @@ bool QChar::isSymbol() const int QChar::digitValue() const { #ifndef QT_NO_UNICODETABLES - register int pos = QUnicodeTables::decimal_info[row()]; + int pos = QUnicodeTables::decimal_info[row()]; if( !pos ) return -1; return QUnicodeTables::decimal_info[(pos<<8) + cell()]; @@ -654,7 +654,7 @@ static QString shared_decomp; const QString &QChar::decomposition() const { #ifndef QT_NO_UNICODETABLES - register int pos = QUnicodeTables::decomposition_info[row()]; + int pos = QUnicodeTables::decomposition_info[row()]; if(!pos) return QString::null; pos = QUnicodeTables::decomposition_info[(pos<<8)+cell()]; @@ -681,7 +681,7 @@ const QString &QChar::decomposition() const QChar::Decomposition QChar::decompositionTag() const { #ifndef QT_NO_UNICODETABLES - register int pos = QUnicodeTables::decomposition_info[row()]; + int pos = QUnicodeTables::decomposition_info[row()]; if(!pos) return QChar::Single; pos = QUnicodeTables::decomposition_info[(pos<<8)+cell()]; @@ -961,7 +961,7 @@ private: QLigature::QLigature( QChar c ) { - register int pos = QUnicodeTables::ligature_info[c.row()]; + int pos = QUnicodeTables::ligature_info[c.row()]; if( !pos ) ligatures = 0; else @@ -2528,7 +2528,7 @@ QString QString::multiArg( int numArgs, const QString& a1, const QString& a2, int digitUsed[10]; int argForDigit[10]; }; - register const QChar *uc = d->unicode; + const QChar *uc = d->unicode; const QString *args[4]; const int len = (int) length(); const int end = len - 1; @@ -3018,7 +3018,7 @@ int QString::find( QChar c, int index, bool cs ) const index += l; if ( (uint)index >= l ) return -1; - register const QChar *uc = unicode()+index; + const QChar *uc = unicode()+index; const QChar *end = unicode() + l; if ( cs ) { while ( uc < end && *uc != c ) @@ -3041,7 +3041,7 @@ int QString::find( QChar c, int index, bool cs ) const static void bm_init_skiptable( const QString &pattern, uint *skiptable, bool cs ) { int i = 0; - register uint *st = skiptable; + uint *st = skiptable; int l = pattern.length(); while ( i++ < 0x100/8 ) { *(st++) = l; @@ -3078,7 +3078,7 @@ static int bm_find( const QString &str, int index, const QString &pattern, uint const uint pl = pattern.length(); const uint pl_minus_one = pl - 1; - register const QChar *current = uc + index + pl_minus_one; + const QChar *current = uc + index + pl_minus_one; const QChar *end = uc + l; if ( cs ) { while ( current < end ) { @@ -3269,7 +3269,7 @@ int QString::findRev( QChar c, int index, bool cs ) const if ( (uint)index >= l ) return -1; const QChar *end = unicode(); - register const QChar *uc = end + index; + const QChar *uc = end + index; if ( cs ) { while ( uc >= end && *uc != c ) uc--; @@ -3836,7 +3836,7 @@ QString QString::mid( uint index, uint len ) const len = slen - index; if ( index == 0 && len == slen ) return *this; - register const QChar *p = unicode()+index; + const QChar *p = unicode()+index; QString s( len, TRUE ); memcpy( s.d->unicode, p, len * sizeof(QChar) ); s.d->len = len; @@ -3938,7 +3938,7 @@ QString QString::rightJustify( uint width, QChar fill, bool truncate ) const QString QString::lower() const { int l = length(); - register QChar *p = d->unicode; + QChar *p = d->unicode; while ( l ) { if ( *p != ::lower(*p) ) { QString s( *this ); @@ -3971,7 +3971,7 @@ QString QString::lower() const QString QString::upper() const { int l = length(); - register QChar *p = d->unicode; + QChar *p = d->unicode; while ( l ) { if ( *p != ::upper(*p) ) { QString s( *this ); @@ -4012,7 +4012,7 @@ QString QString::stripWhiteSpace() const { if ( isEmpty() ) // nothing to do return *this; - register const QChar *s = unicode(); + const QChar *s = unicode(); if ( !s->isSpace() && !s[length()-1].isSpace() ) return *this; @@ -5999,6 +5999,14 @@ void QString::setSecurityUnPaged(bool lock) { */ QCString QString::utf8() const { + if (!d->cString) { + d->cString = new QCString(""); + } + if(d == shared_null) + { + return *d->cString; + } + int l = length(); int rlen = l*3+1; QCString rstr(rlen); @@ -6043,11 +6051,8 @@ QCString QString::utf8() const ++ch; } rstr.truncate( cursor - (uchar*)rstr.data() ); - if (!d->cString) { - d->cString = new QCString; - } *d->cString = rstr; - return rstr; + return *d->cString; } static QChar *addOne(QChar *qch, QString &str) @@ -6249,7 +6254,11 @@ QString QString::fromLatin1( const char* chars, int len ) QCString QString::local8Bit() const { if (!d->cString) { - d->cString = new QCString; + d->cString = new QCString(""); + } + if(d == shared_null) + { + return *d->cString; } #ifdef QT_NO_TEXTCODEC *d->cString = QCString(latin1()); |