diff options
-rw-r--r-- | src/tools/qstring.cpp | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/src/tools/qstring.cpp b/src/tools/qstring.cpp index 62c5af0..3986ecf 100644 --- a/src/tools/qstring.cpp +++ b/src/tools/qstring.cpp @@ -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) @@ -6251,6 +6256,10 @@ QCString QString::local8Bit() const if (!d->cString) { d->cString = new QCString; } + if(d == shared_null) + { + return *d->cString; + } #ifdef QT_NO_TEXTCODEC *d->cString = QCString(latin1()); return *d->cString; |