From 7be255156feb7636a5cca5c4fe78f42879ffe69b Mon Sep 17 00:00:00 2001 From: Robin Burchell Date: Fri, 6 Apr 2012 16:34:19 +0200 Subject: 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 --- src/plugins/platforms/windows/qwindowsdialoghelpers.cpp | 2 +- src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src/plugins/platforms/windows') 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, -- cgit v1.2.3