summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobin Burchell <robin.burchell@collabora.co.uk>2010-07-18 21:05:44 (GMT)
committerAndreas Kling <andreas.kling@nokia.com>2010-07-18 21:05:47 (GMT)
commitc6812138900b05012831e0f94d7d00aeac86cc2f (patch)
tree75c1fd3fbe54fbeb0b131bb71032c813ca6fd086
parent53d3083eecf88a20bc36ada43942c7a18677af62 (diff)
downloadQt-c6812138900b05012831e0f94d7d00aeac86cc2f.zip
Qt-c6812138900b05012831e0f94d7d00aeac86cc2f.tar.gz
Qt-c6812138900b05012831e0f94d7d00aeac86cc2f.tar.bz2
Remove qMemCopy() usage from all .cpp files of Qt itself.
This is (supposedly) more efficient as the compiler can optimise it to a builtin, per Thiago. Merge-request: 2430 Reviewed-by: Andreas Kling <andreas.kling@nokia.com>
-rw-r--r--src/corelib/tools/qbytearray.cpp6
-rw-r--r--src/corelib/tools/qbytearraymatcher.cpp2
-rw-r--r--src/corelib/tools/qstring.cpp6
-rw-r--r--src/corelib/tools/qstringmatcher.cpp2
-rw-r--r--src/gui/text/qfontengine_s60.cpp4
-rw-r--r--src/gui/text/qstatictext.cpp12
-rw-r--r--src/gui/text/qtextdocument_p.cpp2
-rw-r--r--tests/auto/compiler/tst_compiler.cpp2
-rw-r--r--tools/assistant/tools/assistant/helpviewer_qwv.cpp2
-rw-r--r--tools/makeqpf/qpf2.cpp2
10 files changed, 20 insertions, 20 deletions
diff --git a/src/corelib/tools/qbytearray.cpp b/src/corelib/tools/qbytearray.cpp
index b46af1f..a5cb16a 100644
--- a/src/corelib/tools/qbytearray.cpp
+++ b/src/corelib/tools/qbytearray.cpp
@@ -2152,18 +2152,18 @@ QByteArray QByteArray::repeated(int times) const
if (result.d->alloc != resultSize)
return QByteArray(); // not enough memory
- qMemCopy(result.d->data, d->data, d->size);
+ memcpy(result.d->data, d->data, d->size);
int sizeSoFar = d->size;
char *end = result.d->data + sizeSoFar;
const int halfResultSize = resultSize >> 1;
while (sizeSoFar <= halfResultSize) {
- qMemCopy(end, result.d->data, sizeSoFar);
+ memcpy(end, result.d->data, sizeSoFar);
end += sizeSoFar;
sizeSoFar <<= 1;
}
- qMemCopy(end, result.d->data, resultSize - sizeSoFar);
+ memcpy(end, result.d->data, resultSize - sizeSoFar);
result.d->data[resultSize] = '\0';
result.d->size = resultSize;
return result;
diff --git a/src/corelib/tools/qbytearraymatcher.cpp b/src/corelib/tools/qbytearraymatcher.cpp
index d5a59c9..f8504f0 100644
--- a/src/corelib/tools/qbytearraymatcher.cpp
+++ b/src/corelib/tools/qbytearraymatcher.cpp
@@ -171,7 +171,7 @@ QByteArrayMatcher::~QByteArrayMatcher()
QByteArrayMatcher &QByteArrayMatcher::operator=(const QByteArrayMatcher &other)
{
q_pattern = other.q_pattern;
- qMemCopy(&p, &other.p, sizeof(p));
+ memcpy(&p, &other.p, sizeof(p));
return *this;
}
diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp
index b2cf49b..b5651de 100644
--- a/src/corelib/tools/qstring.cpp
+++ b/src/corelib/tools/qstring.cpp
@@ -6156,18 +6156,18 @@ QString QString::repeated(int times) const
if (result.d->alloc != resultSize)
return QString(); // not enough memory
- qMemCopy(result.d->data, d->data, d->size * sizeof(ushort));
+ memcpy(result.d->data, d->data, d->size * sizeof(ushort));
int sizeSoFar = d->size;
ushort *end = result.d->data + sizeSoFar;
const int halfResultSize = resultSize >> 1;
while (sizeSoFar <= halfResultSize) {
- qMemCopy(end, result.d->data, sizeSoFar * sizeof(ushort));
+ memcpy(end, result.d->data, sizeSoFar * sizeof(ushort));
end += sizeSoFar;
sizeSoFar <<= 1;
}
- qMemCopy(end, result.d->data, (resultSize - sizeSoFar) * sizeof(ushort));
+ memcpy(end, result.d->data, (resultSize - sizeSoFar) * sizeof(ushort));
result.d->data[resultSize] = '\0';
result.d->size = resultSize;
return result;
diff --git a/src/corelib/tools/qstringmatcher.cpp b/src/corelib/tools/qstringmatcher.cpp
index ff13624..80a8457 100644
--- a/src/corelib/tools/qstringmatcher.cpp
+++ b/src/corelib/tools/qstringmatcher.cpp
@@ -208,7 +208,7 @@ QStringMatcher &QStringMatcher::operator=(const QStringMatcher &other)
if (this != &other) {
q_pattern = other.q_pattern;
q_cs = other.q_cs;
- qMemCopy(q_data, other.q_data, sizeof(q_data));
+ memcpy(q_data, other.q_data, sizeof(q_data));
}
return *this;
}
diff --git a/src/gui/text/qfontengine_s60.cpp b/src/gui/text/qfontengine_s60.cpp
index f691413..74ef646 100644
--- a/src/gui/text/qfontengine_s60.cpp
+++ b/src/gui/text/qfontengine_s60.cpp
@@ -94,7 +94,7 @@ bool QSymbianTypeFaceExtras::getSfntTableData(uint tag, uchar *buffer, uint *len
} else {
*length = tableByteLength;
if (buffer)
- qMemCopy(buffer, fontTable.TableContent(), tableByteLength);
+ memcpy(buffer, fontTable.TableContent(), tableByteLength);
}
fontTable.Close();
@@ -146,7 +146,7 @@ bool QSymbianTypeFaceExtras::getSfntTableData(uint tag, uchar *buffer, uint *len
} else {
*length = tableByteLength;
if (buffer)
- qMemCopy(buffer, table, tableByteLength);
+ memcpy(buffer, table, tableByteLength);
}
m_trueTypeExtension->ReleaseTrueTypeTable(table);
diff --git a/src/gui/text/qstatictext.cpp b/src/gui/text/qstatictext.cpp
index 91a6612..ab518d0 100644
--- a/src/gui/text/qstatictext.cpp
+++ b/src/gui/text/qstatictext.cpp
@@ -465,13 +465,13 @@ namespace {
m_chars.resize(m_chars.size() + ti.num_chars);
glyph_t *glyphsDestination = m_glyphs.data() + currentItem.glyphOffset;
- qMemCopy(glyphsDestination, glyphs.constData(), sizeof(glyph_t) * currentItem.numGlyphs);
+ memcpy(glyphsDestination, glyphs.constData(), sizeof(glyph_t) * currentItem.numGlyphs);
QFixedPoint *positionsDestination = m_positions.data() + currentItem.positionOffset;
- qMemCopy(positionsDestination, positions.constData(), sizeof(QFixedPoint) * currentItem.numGlyphs);
+ memcpy(positionsDestination, positions.constData(), sizeof(QFixedPoint) * currentItem.numGlyphs);
QChar *charsDestination = m_chars.data() + currentItem.charOffset;
- qMemCopy(charsDestination, ti.chars, sizeof(QChar) * currentItem.numChars);
+ memcpy(charsDestination, ti.chars, sizeof(QChar) * currentItem.numChars);
m_items.append(currentItem);
}
@@ -681,13 +681,13 @@ void QStaticTextPrivate::init()
items = new QStaticTextItem[itemCount];
glyphPool = new glyph_t[glyphs.size()];
- qMemCopy(glyphPool, glyphs.constData(), glyphs.size() * sizeof(glyph_t));
+ memcpy(glyphPool, glyphs.constData(), glyphs.size() * sizeof(glyph_t));
positionPool = new QFixedPoint[positions.size()];
- qMemCopy(positionPool, positions.constData(), positions.size() * sizeof(QFixedPoint));
+ memcpy(positionPool, positions.constData(), positions.size() * sizeof(QFixedPoint));
charPool = new QChar[chars.size()];
- qMemCopy(charPool, chars.constData(), chars.size() * sizeof(QChar));
+ memcpy(charPool, chars.constData(), chars.size() * sizeof(QChar));
for (int i=0; i<itemCount; ++i) {
items[i] = deviceItems.at(i);
diff --git a/src/gui/text/qtextdocument_p.cpp b/src/gui/text/qtextdocument_p.cpp
index 7b3f985..213db7e 100644
--- a/src/gui/text/qtextdocument_p.cpp
+++ b/src/gui/text/qtextdocument_p.cpp
@@ -1649,7 +1649,7 @@ void QTextDocumentPrivate::compressPieceTable()
int newLen = 0;
for (FragmentMap::Iterator it = fragments.begin(); !it.atEnd(); ++it) {
- qMemCopy(newTextPtr, text.constData() + it->stringPosition, it->size_array[0] * sizeof(QChar));
+ memcpy(newTextPtr, text.constData() + it->stringPosition, it->size_array[0] * sizeof(QChar));
it->stringPosition = newLen;
newTextPtr += it->size_array[0];
newLen += it->size_array[0];
diff --git a/tests/auto/compiler/tst_compiler.cpp b/tests/auto/compiler/tst_compiler.cpp
index 368620d..90eb357 100644
--- a/tests/auto/compiler/tst_compiler.cpp
+++ b/tests/auto/compiler/tst_compiler.cpp
@@ -640,7 +640,7 @@ static inline double qt_inf()
#endif
union { uchar c[8]; double d; } returnValue;
- qMemCopy(returnValue.c, bytes, sizeof(returnValue.c));
+ memcpy(returnValue.c, bytes, sizeof(returnValue.c));
return returnValue.d;
}
diff --git a/tools/assistant/tools/assistant/helpviewer_qwv.cpp b/tools/assistant/tools/assistant/helpviewer_qwv.cpp
index dcbbf2c..221e1b8 100644
--- a/tools/assistant/tools/assistant/helpviewer_qwv.cpp
+++ b/tools/assistant/tools/assistant/helpviewer_qwv.cpp
@@ -101,7 +101,7 @@ qint64 HelpNetworkReply::readData(char *buffer, qint64 maxlen)
TRACE_OBJ
qint64 len = qMin(qint64(data.length()), maxlen);
if (len) {
- qMemCopy(buffer, data.constData(), len);
+ memcpy(buffer, data.constData(), len);
data.remove(0, len);
}
if (!data.length())
diff --git a/tools/makeqpf/qpf2.cpp b/tools/makeqpf/qpf2.cpp
index ab57cea..cafdb79 100644
--- a/tools/makeqpf/qpf2.cpp
+++ b/tools/makeqpf/qpf2.cpp
@@ -543,7 +543,7 @@ void QPF::addGlyphs(QFontEngine *fe, const QList<CharacterRange> &ranges)
;
}
- qMemCopy(data, img.bits(), img.byteCount());
+ memcpy(data, img.bits(), img.byteCount());
}
}
}