diff options
Diffstat (limited to 'src/corelib/tools/qstring.cpp')
-rw-r--r-- | src/corelib/tools/qstring.cpp | 43 |
1 files changed, 23 insertions, 20 deletions
diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp index 7589f59..b4c6f57 100644 --- a/src/corelib/tools/qstring.cpp +++ b/src/corelib/tools/qstring.cpp @@ -6956,6 +6956,27 @@ QString QString::multiArg(int numArgs, const QString **args) const return result; } +static bool isStringRightToLeft(const ushort *p, const ushort *end) +{ + bool righttoleft = false; + while (p < end) { + switch(QChar::direction(*p)) + { + case QChar::DirL: + goto end; + case QChar::DirR: + case QChar::DirAL: + righttoleft = true; + goto end; + default: + break; + } + ++p; + } + end: + return righttoleft; +} + /*! \internal */ void QString::updateProperties() const @@ -6972,31 +6993,13 @@ void QString::updateProperties() const p++; } - d->righttoleft = isRightToLeft(); + d->righttoleft = isStringRightToLeft(d->data, d->data + d->size); d->clean = true; } bool QString::isRightToLeft() const { - ushort *p = d->data; - const ushort * const end = p + d->size; - bool righttoleft = false; - while (p < end) { - switch(QChar::direction(*p)) - { - case QChar::DirL: - goto end; - case QChar::DirR: - case QChar::DirAL: - righttoleft = true; - goto end; - default: - break; - } - ++p; - } - end: - return righttoleft; + return isStringRightToLeft(d->data, d->data + d->size); } /*! \fn bool QString::isSimpleText() const |