diff options
author | Robin Burchell <robin+qt@viroteck.net> | 2012-04-06 16:34:19 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-04-11 10:46:19 +0200 |
commit | 7be255156feb7636a5cca5c4fe78f42879ffe69b (patch) | |
tree | 0255287041af5b79cb437e7d9003cd4c9a179dfc | |
parent | 5dc506ad841685c8404c085bd8cf9c5442518897 (diff) |
Deprecate qMemCopy/qMemSet in favour of their stdlib equivilents.
Just like qMalloc/qRealloc/qFree, there is absolutely no reason to wrap these
functions just to avoid an include, except to pay for it with worse runtime
performance.
On OS X, on byte sizes from 50 up to 1000, calling memset directly is 28-15%
faster(!) than adding an additional call to qMemSet. The advantage on sizes
above that is unmeasurable.
For qMemCopy, the benefits are a little more modest: 16-7%.
Change-Id: I98aa92bb765aea0448e3f20af42a039b369af0b3
Reviewed-by: Giuseppe D'Angelo <dangelog@gmail.com>
Reviewed-by: John Brooks <john.brooks@dereferenced.net>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
31 files changed, 48 insertions, 61 deletions
diff --git a/src/corelib/global/qendian.h b/src/corelib/global/qendian.h index e049fb6549..4048eca953 100644 --- a/src/corelib/global/qendian.h +++ b/src/corelib/global/qendian.h @@ -79,7 +79,7 @@ template <typename T> inline void qbswap(const T src, uchar *dest) // If you want to avoid the memcopy, you must write specializations for this function template <typename T> inline void qToUnaligned(const T src, uchar *dest) { - qMemCopy(dest, &src, sizeof(T)); + memcpy(dest, &src, sizeof(T)); } /* T qFromLittleEndian(const uchar *src) diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index 8125161897..51849d701a 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -1964,13 +1964,6 @@ Q_CORE_EXPORT unsigned int qt_int_sqrt(unsigned int n) return p; } -#if defined(qMemCopy) -# undef qMemCopy -#endif -#if defined(qMemSet) -# undef qMemSet -#endif - void *qMemCopy(void *dest, const void *src, size_t n) { return memcpy(dest, src, n); } void *qMemSet(void *dest, int c, size_t n) { return memset(dest, c, n); } diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index ec7de3b1c5..0648b08d1f 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -1189,12 +1189,12 @@ inline void qSwap(T &value1, T &value2) Q_CORE_EXPORT QT_DEPRECATED void *qMalloc(size_t size) Q_ALLOC_SIZE(1); Q_CORE_EXPORT QT_DEPRECATED void qFree(void *ptr); Q_CORE_EXPORT QT_DEPRECATED void *qRealloc(void *ptr, size_t size) Q_ALLOC_SIZE(2); +Q_CORE_EXPORT QT_DEPRECATED void *qMemCopy(void *dest, const void *src, size_t n); +Q_CORE_EXPORT QT_DEPRECATED void *qMemSet(void *dest, int c, size_t n); #endif Q_CORE_EXPORT void *qMallocAligned(size_t size, size_t alignment) Q_ALLOC_SIZE(1); Q_CORE_EXPORT void *qReallocAligned(void *ptr, size_t size, size_t oldsize, size_t alignment) Q_ALLOC_SIZE(2); Q_CORE_EXPORT void qFreeAligned(void *ptr); -Q_CORE_EXPORT void *qMemCopy(void *dest, const void *src, size_t n); -Q_CORE_EXPORT void *qMemSet(void *dest, int c, size_t n); /* @@ -1388,14 +1388,6 @@ inline const QForeachContainer<T> *qForeachContainer(const QForeachContainerBase # endif #endif -#if 0 -/* tell gcc to use its built-in methods for some common functions */ -#if defined(QT_NO_DEBUG) && defined(Q_CC_GNU) -# define qMemCopy __builtin_memcpy -# define qMemSet __builtin_memset -#endif -#endif - template <typename T> static inline T *qGetPtrHelper(T *ptr) { return ptr; } template <typename Wrapper> static inline typename Wrapper::pointer qGetPtrHelper(const Wrapper &p) { return p.data(); } diff --git a/src/corelib/global/qnumeric_p.h b/src/corelib/global/qnumeric_p.h index 851c18203d..cc8e8d271a 100644 --- a/src/corelib/global/qnumeric_p.h +++ b/src/corelib/global/qnumeric_p.h @@ -100,7 +100,7 @@ static inline double qt_inf() : qt_le_inf_bytes); union { unsigned char c[8]; double d; } returnValue; - qMemCopy(returnValue.c, bytes, sizeof(returnValue.c)); + memcpy(returnValue.c, bytes, sizeof(returnValue.c)); return returnValue.d; } @@ -115,7 +115,7 @@ static inline double qt_snan() : qt_le_snan_bytes); union { unsigned char c[8]; double d; } returnValue; - qMemCopy(returnValue.c, bytes, sizeof(returnValue.c)); + memcpy(returnValue.c, bytes, sizeof(returnValue.c)); return returnValue.d; } @@ -130,7 +130,7 @@ static inline double qt_qnan() : qt_le_qnan_bytes); union { unsigned char 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/src/corelib/kernel/qmetaobject.cpp b/src/corelib/kernel/qmetaobject.cpp index a93046dcd1..e3b0b15e26 100644 --- a/src/corelib/kernel/qmetaobject.cpp +++ b/src/corelib/kernel/qmetaobject.cpp @@ -1057,7 +1057,7 @@ QMetaProperty QMetaObject::property(int index) const if (colon > enum_name) { int len = colon-enum_name-1; scope_buffer = (char *)malloc(len+1); - qMemCopy(scope_buffer, enum_name, len); + memcpy(scope_buffer, enum_name, len); scope_buffer[len] = '\0'; scope_name = scope_buffer; enum_name = colon+1; diff --git a/src/corelib/tools/qbytearraymatcher.cpp b/src/corelib/tools/qbytearraymatcher.cpp index a635db0a15..c69602138e 100644 --- a/src/corelib/tools/qbytearraymatcher.cpp +++ b/src/corelib/tools/qbytearraymatcher.cpp @@ -121,7 +121,7 @@ QByteArrayMatcher::QByteArrayMatcher() { p.p = 0; p.l = 0; - qMemSet(p.q_skiptable, 0, sizeof(p.q_skiptable)); + memset(p.q_skiptable, 0, sizeof(p.q_skiptable)); } /*! diff --git a/src/corelib/tools/qstring.h b/src/corelib/tools/qstring.h index a902f5f375..4936bcec2a 100644 --- a/src/corelib/tools/qstring.h +++ b/src/corelib/tools/qstring.h @@ -814,7 +814,7 @@ inline QString QString::section(QChar asep, int astart, int aend, SectionFlags a inline int QString::toWCharArray(wchar_t *array) const { if (sizeof(wchar_t) == sizeof(QChar)) { - qMemCopy(array, d->data(), sizeof(QChar) * size()); + memcpy(array, d->data(), sizeof(QChar) * size()); return size(); } return toUcs4_helper(d->data(), size(), reinterpret_cast<uint *>(array)); diff --git a/src/corelib/tools/qstringmatcher.cpp b/src/corelib/tools/qstringmatcher.cpp index faab7a903f..382d2e9411 100644 --- a/src/corelib/tools/qstringmatcher.cpp +++ b/src/corelib/tools/qstringmatcher.cpp @@ -151,7 +151,7 @@ static inline int bm_find(const ushort *uc, uint l, int index, const ushort *puc QStringMatcher::QStringMatcher() : d_ptr(0), q_cs(Qt::CaseSensitive) { - qMemSet(q_data, 0, sizeof(q_data)); + memset(q_data, 0, sizeof(q_data)); } /*! diff --git a/src/corelib/tools/qvarlengtharray.h b/src/corelib/tools/qvarlengtharray.h index 6ce6573843..639d2463fd 100644 --- a/src/corelib/tools/qvarlengtharray.h +++ b/src/corelib/tools/qvarlengtharray.h @@ -230,7 +230,7 @@ Q_OUTOFLINE_TEMPLATE void QVarLengthArray<T, Prealloc>::append(const T *abuf, in while (s < asize) new (ptr+(s++)) T(*abuf++); } else { - qMemCopy(&ptr[s], abuf, increment * sizeof(T)); + memcpy(&ptr[s], abuf, increment * sizeof(T)); s = asize; } } @@ -268,7 +268,7 @@ Q_OUTOFLINE_TEMPLATE void QVarLengthArray<T, Prealloc>::realloc(int asize, int a QT_RETHROW; } } else { - qMemCopy(ptr, oldPtr, copySize * sizeof(T)); + memcpy(ptr, oldPtr, copySize * sizeof(T)); } } else { ptr = oldPtr; diff --git a/src/corelib/tools/qvector.h b/src/corelib/tools/qvector.h index 3c0db06589..b36b832c26 100644 --- a/src/corelib/tools/qvector.h +++ b/src/corelib/tools/qvector.h @@ -418,7 +418,7 @@ QVector<T>::QVector(int asize) while (i != b) new (--i) T; } else { - qMemSet(d->begin(), 0, asize * sizeof(T)); + memset(d->begin(), 0, asize * sizeof(T)); } } @@ -546,7 +546,7 @@ void QVector<T>::realloc(int asize, int aalloc) } else if (asize > x->size) { // initialize newly allocated memory to 0 - qMemSet(x->end(), 0, (asize - x->size) * sizeof(T)); + memset(x->end(), 0, (asize - x->size) * sizeof(T)); } x->size = asize; diff --git a/src/gui/accessible/qaccessible.h b/src/gui/accessible/qaccessible.h index 91726f194b..180ab61ef9 100644 --- a/src/gui/accessible/qaccessible.h +++ b/src/gui/accessible/qaccessible.h @@ -51,6 +51,8 @@ #include <QtGui/qcolor.h> #include <QtGui/qevent.h> +#include <stdlib.h> + QT_BEGIN_HEADER QT_BEGIN_NAMESPACE @@ -216,7 +218,7 @@ public: // quint64 alertHigh : 1; State() { - qMemSet(this, 0, sizeof(State)); + memset(this, 0, sizeof(State)); } }; diff --git a/src/gui/image/qpnghandler.cpp b/src/gui/image/qpnghandler.cpp index 7acad067b5..c3ae0a41da 100644 --- a/src/gui/image/qpnghandler.cpp +++ b/src/gui/image/qpnghandler.cpp @@ -184,7 +184,7 @@ void CALLBACK_CALL_TYPE iod_read_fn(png_structp png_ptr, png_bytep data, png_siz if (d->state == QPngHandlerPrivate::ReadingEnd && !in->isSequential() && (in->size() - in->pos()) < 4 && length == 4) { // Workaround for certain malformed PNGs that lack the final crc bytes uchar endcrc[4] = { 0xae, 0x42, 0x60, 0x82 }; - qMemCopy(data, endcrc, 4); + memcpy(data, endcrc, 4); in->seek(in->size()); return; } @@ -664,7 +664,7 @@ static void set_text(const QImage &image, png_structp png_ptr, png_infop info_pt return; png_textp text_ptr = new png_text[text.size()]; - qMemSet(text_ptr, 0, text.size() * sizeof(png_text)); + memset(text_ptr, 0, text.size() * sizeof(png_text)); QMap<QString, QString>::ConstIterator it = text.constBegin(); int i = 0; diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp index 849955100b..97b0f91c26 100644 --- a/src/gui/painting/qpainter.cpp +++ b/src/gui/painting/qpainter.cpp @@ -5594,9 +5594,9 @@ void QPainterPrivate::drawGlyphs(const quint32 *glyphArray, QFixedPoint *positio QVarLengthArray<QFixed, 128> advances(glyphCount); QVarLengthArray<QGlyphJustification, 128> glyphJustifications(glyphCount); QVarLengthArray<HB_GlyphAttributes, 128> glyphAttributes(glyphCount); - qMemSet(glyphAttributes.data(), 0, glyphAttributes.size() * sizeof(HB_GlyphAttributes)); - qMemSet(advances.data(), 0, advances.size() * sizeof(QFixed)); - qMemSet(glyphJustifications.data(), 0, glyphJustifications.size() * sizeof(QGlyphJustification)); + memset(glyphAttributes.data(), 0, glyphAttributes.size() * sizeof(HB_GlyphAttributes)); + memset(advances.data(), 0, advances.size() * sizeof(QFixed)); + memset(glyphJustifications.data(), 0, glyphJustifications.size() * sizeof(QGlyphJustification)); textItem.glyphs.numGlyphs = glyphCount; textItem.glyphs.glyphs = reinterpret_cast<HB_Glyph *>(const_cast<quint32 *>(glyphArray)); diff --git a/src/gui/text/qfontengine_qpa.cpp b/src/gui/text/qfontengine_qpa.cpp index d12e2d651c..bf0cfd1404 100644 --- a/src/gui/text/qfontengine_qpa.cpp +++ b/src/gui/text/qfontengine_qpa.cpp @@ -612,7 +612,7 @@ void QPAGenerator::writeGMap() const int numBytes = glyphCount * sizeof(quint32); qint64 pos = buffer.size(); buffer.resize(pos + numBytes); - qMemSet(buffer.data() + pos, 0xff, numBytes); + memset(buffer.data() + pos, 0xff, numBytes); dev->seek(pos + numBytes); } diff --git a/src/gui/text/qfontengine_qpf.cpp b/src/gui/text/qfontengine_qpf.cpp index 64596ebaf5..23f263b0bd 100644 --- a/src/gui/text/qfontengine_qpf.cpp +++ b/src/gui/text/qfontengine_qpf.cpp @@ -1120,7 +1120,7 @@ void QPFGenerator::writeGMap() const int numBytes = glyphCount * sizeof(quint32); qint64 pos = buffer.size(); buffer.resize(pos + numBytes); - qMemSet(buffer.data() + pos, 0xff, numBytes); + memset(buffer.data() + pos, 0xff, numBytes); dev->seek(pos + numBytes); } diff --git a/src/gui/text/qfontenginedirectwrite.cpp b/src/gui/text/qfontenginedirectwrite.cpp index 0f21ae8a1e..4843d7f12e 100644 --- a/src/gui/text/qfontenginedirectwrite.cpp +++ b/src/gui/text/qfontenginedirectwrite.cpp @@ -247,7 +247,7 @@ bool QFontEngineDirectWrite::getSfntTableData(uint tag, uchar *buffer, uint *len return false; } - qMemCopy(buffer, tableData, tableSize); + memcpy(buffer, tableData, tableSize); m_directWriteFontFace->ReleaseFontTable(tableContext); return true; @@ -597,7 +597,7 @@ QImage QFontEngineDirectWrite::imageForGlyph(glyph_t t, int size = width * height * 3; if (size > 0) { BYTE *alphaValues = new BYTE[size]; - qMemSet(alphaValues, size, 0); + memset(alphaValues, size, 0); hr = glyphAnalysis->CreateAlphaTexture(DWRITE_TEXTURE_CLEARTYPE_3x1, &rect, diff --git a/src/gui/text/qglyphrun.cpp b/src/gui/text/qglyphrun.cpp index 813e0a804a..673dd8f03b 100644 --- a/src/gui/text/qglyphrun.cpp +++ b/src/gui/text/qglyphrun.cpp @@ -221,7 +221,7 @@ QVector<quint32> QGlyphRun::glyphIndexes() const return d->glyphIndexes; } else { QVector<quint32> indexes(d->glyphIndexDataSize); - qMemCopy(indexes.data(), d->glyphIndexData, d->glyphIndexDataSize * sizeof(quint32)); + memcpy(indexes.data(), d->glyphIndexData, d->glyphIndexDataSize * sizeof(quint32)); return indexes; } } @@ -247,7 +247,7 @@ QVector<QPointF> QGlyphRun::positions() const return d->glyphPositions; } else { QVector<QPointF> glyphPositions(d->glyphPositionDataSize); - qMemCopy(glyphPositions.data(), d->glyphPositionData, + memcpy(glyphPositions.data(), d->glyphPositionData, d->glyphPositionDataSize * sizeof(QPointF)); return glyphPositions; } diff --git a/src/gui/text/qrawfont.cpp b/src/gui/text/qrawfont.cpp index 5cdd563a33..3bd4d88872 100644 --- a/src/gui/text/qrawfont.cpp +++ b/src/gui/text/qrawfont.cpp @@ -504,7 +504,7 @@ QVector<QPointF> QRawFont::advancesForGlyphIndexes(const QVector<quint32> &glyph int numGlyphs = glyphIndexes.size(); QVarLengthGlyphLayoutArray glyphs(numGlyphs); - qMemCopy(glyphs.glyphs, glyphIndexes.data(), numGlyphs * sizeof(quint32)); + memcpy(glyphs.glyphs, glyphIndexes.data(), numGlyphs * sizeof(quint32)); d->fontEngine->recalcAdvances(&glyphs, 0); diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp index 7d366275a3..c5c6b2e621 100644 --- a/src/gui/text/qtextengine.cpp +++ b/src/gui/text/qtextengine.cpp @@ -1000,7 +1000,7 @@ void QTextEngine::shapeTextWithHarfbuzz(int item) const kerningEnabled = this->font(si).d->kerning; HB_ShaperItem entire_shaper_item; - qMemSet(&entire_shaper_item, 0, sizeof(entire_shaper_item)); + memset(&entire_shaper_item, 0, sizeof(entire_shaper_item)); entire_shaper_item.string = reinterpret_cast<const HB_UChar16 *>(layoutData->string.constData()); entire_shaper_item.stringLength = layoutData->string.length(); entire_shaper_item.item.script = (HB_Script)si.analysis.script; diff --git a/src/network/access/qnetworkreplyimpl.cpp b/src/network/access/qnetworkreplyimpl.cpp index c0b8acc581..c65d790fec 100644 --- a/src/network/access/qnetworkreplyimpl.cpp +++ b/src/network/access/qnetworkreplyimpl.cpp @@ -973,7 +973,7 @@ qint64 QNetworkReplyImpl::readData(char *data, qint64 maxlen) if (maxAvail == 0) return d->state == QNetworkReplyImplPrivate::Finished ? -1 : 0; // FIXME what about "Aborted" state? - qMemCopy(data, d->downloadBuffer + d->downloadBufferReadPosition, maxAvail); + memcpy(data, d->downloadBuffer + d->downloadBufferReadPosition, maxAvail); d->downloadBufferReadPosition += maxAvail; return maxAvail; } diff --git a/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp b/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp index 1239f3d8e2..9621846284 100644 --- a/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp +++ b/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp @@ -850,7 +850,7 @@ int QWindowsNativeFileDialogBase::itemPaths(IShellItemArray *items, static inline void toBuffer(const QString &what, WCHAR **ptr) { const int length = 1 + what.size(); - qMemCopy(*ptr, what.utf16(), length * sizeof(WCHAR)); + memcpy(*ptr, what.utf16(), length * sizeof(WCHAR)); *ptr += length; } diff --git a/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp b/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp index 82410bfb21..c8906bd3c9 100644 --- a/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp +++ b/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp @@ -275,7 +275,7 @@ bool QWindowsFontEngineDirectWrite::getSfntTableData(uint tag, uchar *buffer, ui return false; } - qMemCopy(buffer, tableData, tableSize); + memcpy(buffer, tableData, tableSize); m_directWriteFontFace->ReleaseFontTable(tableContext); return true; @@ -570,7 +570,7 @@ QImage QWindowsFontEngineDirectWrite::imageForGlyph(glyph_t t, int size = width * height * 3; BYTE *alphaValues = new BYTE[size]; - qMemSet(alphaValues, size, 0); + memset(alphaValues, size, 0); hr = glyphAnalysis->CreateAlphaTexture(DWRITE_TEXTURE_CLEARTYPE_3x1, &rect, diff --git a/src/tools/moc/main.cpp b/src/tools/moc/main.cpp index 6f67a7dddf..5e87632988 100644 --- a/src/tools/moc/main.cpp +++ b/src/tools/moc/main.cpp @@ -143,7 +143,7 @@ QByteArray composePreprocessorOutput(const Symbols &symbols) { const int padding = sym.lineNum - lineNum; if (padding > 0) { output.resize(output.size() + padding); - qMemSet(output.data() + output.size() - padding, '\n', padding); + memset(output.data() + output.size() - padding, '\n', padding); lineNum = sym.lineNum; } diff --git a/src/widgets/kernel/qgridlayout.cpp b/src/widgets/kernel/qgridlayout.cpp index 39daf96eb8..c81158e0cd 100644 --- a/src/widgets/kernel/qgridlayout.cpp +++ b/src/widgets/kernel/qgridlayout.cpp @@ -779,7 +779,7 @@ void QGridLayoutPrivate::setupLayoutData(int hSpacing, int vSpacing) adjacent to which and compute the spacings correctly. */ QVarLengthArray<QGridBox *> grid(rr * cc); - qMemSet(grid.data(), 0, rr * cc * sizeof(QGridBox *)); + memset(grid.data(), 0, rr * cc * sizeof(QGridBox *)); /* Initialize 'sizes' and 'grid' data structures, and insert diff --git a/tests/auto/corelib/io/qabstractfileengine/tst_qabstractfileengine.cpp b/tests/auto/corelib/io/qabstractfileengine/tst_qabstractfileengine.cpp index c6ccc9308a..0cafc1d5ad 100644 --- a/tests/auto/corelib/io/qabstractfileengine/tst_qabstractfileengine.cpp +++ b/tests/auto/corelib/io/qabstractfileengine/tst_qabstractfileengine.cpp @@ -402,7 +402,7 @@ public: if (readSize < 0) return -1; - qMemCopy(data, openFile_->content.constData() + position_, readSize); + memcpy(data, openFile_->content.constData() + position_, readSize); position_ += readSize; return readSize; diff --git a/tests/auto/corelib/tools/qbytearray/tst_qbytearray.cpp b/tests/auto/corelib/tools/qbytearray/tst_qbytearray.cpp index b7793051b1..037893a13e 100644 --- a/tests/auto/corelib/tools/qbytearray/tst_qbytearray.cpp +++ b/tests/auto/corelib/tools/qbytearray/tst_qbytearray.cpp @@ -622,7 +622,7 @@ void tst_QByteArray::fromBase64() void tst_QByteArray::qvsnprintf() { char buf[20]; - qMemSet(buf, 42, sizeof(buf)); + memset(buf, 42, sizeof(buf)); QCOMPARE(::qsnprintf(buf, 10, "%s", "bubu"), 4); QCOMPARE(static_cast<const char *>(buf), "bubu"); @@ -631,12 +631,12 @@ void tst_QByteArray::qvsnprintf() QCOMPARE(buf[5], char(42)); #endif - qMemSet(buf, 42, sizeof(buf)); + memset(buf, 42, sizeof(buf)); QCOMPARE(::qsnprintf(buf, 5, "%s", "bubu"), 4); QCOMPARE(static_cast<const char *>(buf), "bubu"); QCOMPARE(buf[5], char(42)); - qMemSet(buf, 42, sizeof(buf)); + memset(buf, 42, sizeof(buf)); #ifdef Q_OS_WIN // VS 2005 uses the Qt implementation of vsnprintf. # if defined(_MSC_VER) && _MSC_VER >= 1400 && !defined(Q_OS_WINCE) @@ -661,7 +661,7 @@ void tst_QByteArray::qvsnprintf() QCOMPARE(buf[4], char(42)); #ifndef Q_OS_WIN - qMemSet(buf, 42, sizeof(buf)); + memset(buf, 42, sizeof(buf)); QCOMPARE(::qsnprintf(buf, 10, ""), 0); #endif } diff --git a/tests/auto/gui/image/qimagewriter/tst_qimagewriter.cpp b/tests/auto/gui/image/qimagewriter/tst_qimagewriter.cpp index 932d652b69..827fa3606c 100644 --- a/tests/auto/gui/image/qimagewriter/tst_qimagewriter.cpp +++ b/tests/auto/gui/image/qimagewriter/tst_qimagewriter.cpp @@ -112,7 +112,7 @@ static void initializePadding(QImage *image) if (paddingBytes == 0) return; for (int y = 0; y < image->height(); ++y) { - qMemSet(image->scanLine(y) + effectiveBytesPerLine, 0, paddingBytes); + memset(image->scanLine(y) + effectiveBytesPerLine, 0, paddingBytes); } } @@ -454,7 +454,7 @@ void tst_QImageWriter::saveWithNoFormat() SKIP_IF_UNSUPPORTED(format); QImage niceImage(64, 64, QImage::Format_ARGB32); - qMemSet(niceImage.bits(), 0, niceImage.byteCount()); + memset(niceImage.bits(), 0, niceImage.byteCount()); QImageWriter writer(fileName /* , 0 - no format! */); if (error != 0) { diff --git a/tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp b/tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp index 5eaf8b1b2c..47c40032c3 100644 --- a/tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp +++ b/tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp @@ -400,7 +400,7 @@ bool tst_QFileSystemModel::createFiles(const QString &test_path, const QStringLi if (initial_files.at(i)[0] == '.') { QString hiddenFile = QDir::toNativeSeparators(file.fileName()); wchar_t nativeHiddenFile[MAX_PATH]; - qMemSet(nativeHiddenFile, 0, sizeof(nativeHiddenFile)); + memset(nativeHiddenFile, 0, sizeof(nativeHiddenFile)); hiddenFile.toWCharArray(nativeHiddenFile); DWORD currentAttributes = ::GetFileAttributes(nativeHiddenFile); if (currentAttributes == 0xFFFFFFFF) { diff --git a/tests/auto/widgets/itemviews/qitemdelegate/tst_qitemdelegate.cpp b/tests/auto/widgets/itemviews/qitemdelegate/tst_qitemdelegate.cpp index 2ee166c4a2..f9610fab16 100644 --- a/tests/auto/widgets/itemviews/qitemdelegate/tst_qitemdelegate.cpp +++ b/tests/auto/widgets/itemviews/qitemdelegate/tst_qitemdelegate.cpp @@ -885,7 +885,7 @@ void tst_QItemDelegate::decoration() } case QVariant::Image: { QImage img(size, QImage::Format_Mono); - qMemSet(img.bits(), 0, img.byteCount()); + memset(img.bits(), 0, img.byteCount()); value = img; break; } diff --git a/tests/baselineserver/shared/baselineprotocol.cpp b/tests/baselineserver/shared/baselineprotocol.cpp index 9fcd99546c..a687c8d61b 100644 --- a/tests/baselineserver/shared/baselineprotocol.cpp +++ b/tests/baselineserver/shared/baselineprotocol.cpp @@ -232,7 +232,7 @@ quint64 ImageItem::computeChecksum(const QImage &image) uchar *p = img.bits() + bpl - padBytes; const int h = img.height(); for (int y = 0; y < h; ++y) { - qMemSet(p, 0, padBytes); + memset(p, 0, padBytes); p += bpl; } } diff --git a/tests/benchmarks/corelib/tools/qvector/qrawvector.h b/tests/benchmarks/corelib/tools/qvector/qrawvector.h index 8c2d014a41..18d9847c95 100644 --- a/tests/benchmarks/corelib/tools/qvector/qrawvector.h +++ b/tests/benchmarks/corelib/tools/qvector/qrawvector.h @@ -379,7 +379,7 @@ QRawVector<T>::QRawVector(int asize) while (i != b) new (--i) T; } else { - qMemSet(m_begin, 0, asize * sizeof(T)); + memset(m_begin, 0, asize * sizeof(T)); } } @@ -474,7 +474,7 @@ void QRawVector<T>::realloc(int asize, int aalloc, bool ref) } else if (asize > xsize) { // initialize newly allocated memory to 0 - qMemSet(xbegin + xsize, 0, (asize - xsize) * sizeof(T)); + memset(xbegin + xsize, 0, (asize - xsize) * sizeof(T)); } xsize = asize; |