From: Robin Burchell Date: Fri, 6 Apr 2012 14:34:19 +0000 (+0200) Subject: Deprecate qMemCopy/qMemSet in favour of their stdlib equivilents. X-Git-Tag: 071012110112~1235^2^2~77 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7be255156feb7636a5cca5c4fe78f42879ffe69b;p=profile%2Fivi%2Fqtbase.git 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 Reviewed-by: John Brooks Reviewed-by: Thiago Macieira Reviewed-by: Lars Knoll --- diff --git a/src/corelib/global/qendian.h b/src/corelib/global/qendian.h index e049fb6..4048eca 100644 --- a/src/corelib/global/qendian.h +++ b/src/corelib/global/qendian.h @@ -79,7 +79,7 @@ template inline void qbswap(const T src, uchar *dest) // If you want to avoid the memcopy, you must write specializations for this function template 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 8125161..51849d7 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 ec7de3b..0648b08 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 *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 static inline T *qGetPtrHelper(T *ptr) { return ptr; } template 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 851c182..cc8e8d2 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 a93046d..e3b0b15 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 a635db0..c696021 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 a902f5f..4936bce 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(array)); diff --git a/src/corelib/tools/qstringmatcher.cpp b/src/corelib/tools/qstringmatcher.cpp index faab7a9..382d2e9 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 6ce6573..639d246 100644 --- a/src/corelib/tools/qvarlengtharray.h +++ b/src/corelib/tools/qvarlengtharray.h @@ -230,7 +230,7 @@ Q_OUTOFLINE_TEMPLATE void QVarLengthArray::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::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 3c0db06..b36b832 100644 --- a/src/corelib/tools/qvector.h +++ b/src/corelib/tools/qvector.h @@ -418,7 +418,7 @@ QVector::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::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 91726f1..180ab61 100644 --- a/src/gui/accessible/qaccessible.h +++ b/src/gui/accessible/qaccessible.h @@ -51,6 +51,8 @@ #include #include +#include + 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 7acad06..c3ae0a4 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::ConstIterator it = text.constBegin(); int i = 0; diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp index 8499551..97b0f91 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 advances(glyphCount); QVarLengthArray glyphJustifications(glyphCount); QVarLengthArray 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(const_cast(glyphArray)); diff --git a/src/gui/text/qfontengine_qpa.cpp b/src/gui/text/qfontengine_qpa.cpp index d12e2d6..bf0cfd1 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 64596eb..23f263b 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 0f21ae8..4843d7f 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 813e0a8..673dd8f 100644 --- a/src/gui/text/qglyphrun.cpp +++ b/src/gui/text/qglyphrun.cpp @@ -221,7 +221,7 @@ QVector QGlyphRun::glyphIndexes() const return d->glyphIndexes; } else { QVector 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 QGlyphRun::positions() const return d->glyphPositions; } else { QVector 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 5cdd563..3bd4d88 100644 --- a/src/gui/text/qrawfont.cpp +++ b/src/gui/text/qrawfont.cpp @@ -504,7 +504,7 @@ QVector QRawFont::advancesForGlyphIndexes(const QVector &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 7d36627..c5c6b2e 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(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 c0b8acc..c65d790 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 1239f3d..9621846 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 82410bf..c8906bd 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 6f67a7d..5e87632 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 39daf96..c81158e 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 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 c6ccc93..0cafc1d 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 b779305..037893a 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(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(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 932d652..827fa36 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 5eaf8b1..47c4003 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 2ee166c..f9610fa 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 9fcd995..a687c8d 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 8c2d014..18d9847 100644 --- a/tests/benchmarks/corelib/tools/qvector/qrawvector.h +++ b/tests/benchmarks/corelib/tools/qvector/qrawvector.h @@ -379,7 +379,7 @@ QRawVector::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::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;