summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorAndreas Kling <andreas.kling@nokia.com>2010-03-03 16:31:40 (GMT)
committerAndreas Kling <andreas.kling@nokia.com>2010-03-03 17:02:52 (GMT)
commitc9c1ae3030bff8b8e64d1c4e02f28faba1a8eb68 (patch)
treedd296542a9f718a75f3c14d3886e7854b98fc036 /src/gui
parent97728e94e199017204d9c70f042ccb62e4eacc90 (diff)
downloadQt-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
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/text/qtextengine.cpp4
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) {