diff options
author | Andreas Kling <andreas.kling@nokia.com> | 2010-03-03 16:31:40 (GMT) |
---|---|---|
committer | Andreas Kling <andreas.kling@nokia.com> | 2010-03-03 17:02:52 (GMT) |
commit | c9c1ae3030bff8b8e64d1c4e02f28faba1a8eb68 (patch) | |
tree | dd296542a9f718a75f3c14d3886e7854b98fc036 | |
parent | 97728e94e199017204d9c70f042ccb62e4eacc90 (diff) | |
download | Qt-c9c1ae3030bff8b8e64d1c4e02f28faba1a8eb68.zip Qt-c9c1ae3030bff8b8e64d1c4e02f28faba1a8eb68.tar.gz Qt-c9c1ae3030bff8b8e64d1c4e02f28faba1a8eb68.tar.bz2 |
Avoid QString reallocation in QTextEngine::itemize()
Calling QString::utf16() will cause reallocation (for null-termination)
if the string was created via fromRawData().
Reviewed-by: Benjamin Poulain
-rw-r--r-- | src/gui/text/qtextengine.cpp | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp index 02eae98..2291138 100644 --- a/src/gui/text/qtextengine.cpp +++ b/src/gui/text/qtextengine.cpp @@ -1434,9 +1434,7 @@ void QTextEngine::itemize() const layoutData->hasBidi = bidiItemize(const_cast<QTextEngine *>(this), analysis, control); } - const ushort *unicode = layoutData->string.utf16(); - // correctly assign script, isTab and isObject to the script analysis - const ushort *uc = unicode; + const ushort *uc = reinterpret_cast<const ushort *>(layoutData->string.unicode()); const ushort *e = uc + length; int lastScript = QUnicodeTables::Common; while (uc < e) { |