From ea68e4ddcf903bde74ded9d588a09863491d1d56 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Thu, 27 May 2010 10:28:52 +0200 Subject: Replace memmove with memcpy qMemCopy is faster than memmove, and there's no chance of overlapping source and destination memory in these cases. Reviewed-by: Samuel --- src/gui/text/qstatictext.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/gui/text/qstatictext.cpp b/src/gui/text/qstatictext.cpp index 2889a96..84c1d96 100644 --- a/src/gui/text/qstatictext.cpp +++ b/src/gui/text/qstatictext.cpp @@ -439,13 +439,13 @@ namespace { m_chars.resize(m_chars.size() + ti.num_chars); glyph_t *glyphsDestination = m_glyphs.data() + currentItem.glyphOffset; - memmove(glyphsDestination, glyphs.constData(), sizeof(glyph_t) * currentItem.numGlyphs); + qMemCopy(glyphsDestination, glyphs.constData(), sizeof(glyph_t) * currentItem.numGlyphs); QFixedPoint *positionsDestination = m_positions.data() + currentItem.positionOffset; - memmove(positionsDestination, positions.constData(), sizeof(QFixedPoint) * currentItem.numGlyphs); + qMemCopy(positionsDestination, positions.constData(), sizeof(QFixedPoint) * currentItem.numGlyphs); QChar *charsDestination = m_chars.data() + currentItem.charOffset; - memmove(charsDestination, ti.chars, sizeof(QChar) * currentItem.numChars); + qMemCopy(charsDestination, ti.chars, sizeof(QChar) * currentItem.numChars); m_items.append(currentItem); } @@ -647,13 +647,13 @@ void QStaticTextPrivate::init() items = new QStaticTextItem[itemCount]; glyphPool = new glyph_t[glyphs.size()]; - memmove(glyphPool, glyphs.constData(), glyphs.size() * sizeof(glyph_t)); + qMemCopy(glyphPool, glyphs.constData(), glyphs.size() * sizeof(glyph_t)); positionPool = new QFixedPoint[positions.size()]; - memmove(positionPool, positions.constData(), positions.size() * sizeof(QFixedPoint)); + qMemCopy(positionPool, positions.constData(), positions.size() * sizeof(QFixedPoint)); charPool = new QChar[chars.size()]; - memmove(charPool, chars.constData(), chars.size() * sizeof(QChar)); + qMemCopy(charPool, chars.constData(), chars.size() * sizeof(QChar)); for (int i=0; i