summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDebao Zhang <dbzhang800@gmail.com>2012-04-25 23:48:38 -0700
committerQt by Nokia <qt-info@nokia.com>2012-04-27 03:08:16 +0200
commit1fc3d7d52666f318c83251c307b23f6ebe737b35 (patch)
treece2ab12f44351fe84b1b726a35fd511254293bd1
parent210fd5e49bd54dfc68395fb119ffa6961499feda (diff)
qMalloc, qFree, qRealloc, qMemCopy, qMemSet are deprecated.
Use the stdlib version directly instead Change-Id: Icbcab5281ae601d3a44f048b969dc0f9c283e643 Reviewed-by: Sarah Jane Smith <sarah.j.smith@nokia.com>
-rw-r--r--demos/qt3d/pageflip/pageflipmath.cpp5
-rw-r--r--src/plugins/sceneformats/assimp/ailoaderiosystem.cpp2
-rw-r--r--src/threed/arrays/qarray.h12
-rw-r--r--src/threed/arrays/qcustomdataarray.cpp14
-rw-r--r--src/threed/geometry/qgeometrydata.cpp8
5 files changed, 21 insertions, 20 deletions
diff --git a/demos/qt3d/pageflip/pageflipmath.cpp b/demos/qt3d/pageflip/pageflipmath.cpp
index 8f6d85561..4853fc28a 100644
--- a/demos/qt3d/pageflip/pageflipmath.cpp
+++ b/demos/qt3d/pageflip/pageflipmath.cpp
@@ -41,6 +41,7 @@
#include "pageflipmath_p.h"
#include <QtCore/qmath.h>
+#include <string.h>
QT_BEGIN_NAMESPACE
@@ -53,8 +54,8 @@ PageFlipMath::PageFlipMath()
m_showPageReverse = false;
m_startCorner = BottomRight;
- qMemSet(vertices, 0, sizeof(vertices));
- qMemSet(pageCount, 0, sizeof(pageCount));
+ memset(vertices, 0, sizeof(vertices));
+ memset(pageCount, 0, sizeof(pageCount));
}
PageFlipMath::~PageFlipMath()
diff --git a/src/plugins/sceneformats/assimp/ailoaderiosystem.cpp b/src/plugins/sceneformats/assimp/ailoaderiosystem.cpp
index 50b00dcf6..222ed6d6e 100644
--- a/src/plugins/sceneformats/assimp/ailoaderiosystem.cpp
+++ b/src/plugins/sceneformats/assimp/ailoaderiosystem.cpp
@@ -95,7 +95,7 @@ Assimp::IOStream* AiLoaderIOSystem::Open(const char* pFile, const char* pMode)
}
char mode_str[4];
- qMemSet(mode_str, '\0', 4);
+ memset(mode_str, '\0', 4);
int i = 0;
for (const char *ptr = pMode; i < 4 && *ptr; ++ptr)
{
diff --git a/src/threed/arrays/qarray.h b/src/threed/arrays/qarray.h
index 6a609b142..64ca679ef 100644
--- a/src/threed/arrays/qarray.h
+++ b/src/threed/arrays/qarray.h
@@ -350,7 +350,7 @@ Q_INLINE_TEMPLATE void QArray<T, PreallocSize>::release()
if (!m_data->ref.deref()) {
if (QTypeInfo<T>::isComplex)
free(m_start, m_end - m_start);
- qFree(m_data);
+ ::free(m_data);
}
} else if (this->isPrealloc(m_start)) {
if (QTypeInfo<T>::isComplex)
@@ -375,7 +375,7 @@ template <typename T, int PreallocSize>
Q_INLINE_TEMPLATE typename QArray<T, PreallocSize>::Data *QArray<T, PreallocSize>::copyData(const T *src, int size, int capacity)
{
Data *data = reinterpret_cast<Data *>
- (qMalloc(sizeof(Data) + sizeof(T) * (capacity - 1)));
+ (malloc(sizeof(Data) + sizeof(T) * (capacity - 1)));
Q_CHECK_PTR(data);
data->ref.store(1);
data->capacity = capacity;
@@ -390,7 +390,7 @@ Q_INLINE_TEMPLATE typename QArray<T, PreallocSize>::Data *QArray<T, PreallocSize
} QT_CATCH(...) {
while (copied-- > 0)
(--dst)->~T();
- qFree(data);
+ ::free(data);
QT_RETHROW;
}
return data;
@@ -402,14 +402,14 @@ Q_INLINE_TEMPLATE void QArray<T, PreallocSize>::reallocate(int capacity)
int size = m_end - m_start;
if (!QTypeInfo<T>::isStatic) {
Data *data = reinterpret_cast<Data *>
- (qRealloc(m_data, sizeof(Data) + sizeof(T) * (capacity - 1)));
+ (realloc(m_data, sizeof(Data) + sizeof(T) * (capacity - 1)));
Q_CHECK_PTR(data);
data->capacity = capacity;
m_data = data;
} else {
Data *data = copyData(m_data->array, size, capacity);
free(m_data->array, size);
- qFree(m_data);
+ ::free(m_data);
m_data = data;
}
m_start = m_data->array;
@@ -500,7 +500,7 @@ Q_OUTOFLINE_TEMPLATE void QArray<T, PreallocSize>::setSize(int size)
} else {
int capacity = qArrayAllocMore(size, 0, sizeof(T));
Data *data = reinterpret_cast<Data *>
- (qMalloc(sizeof(Data) + sizeof(T) * (capacity - 1)));
+ (malloc(sizeof(Data) + sizeof(T) * (capacity - 1)));
Q_CHECK_PTR(data);
m_data = data;
m_data->ref.store(1);
diff --git a/src/threed/arrays/qcustomdataarray.cpp b/src/threed/arrays/qcustomdataarray.cpp
index 39012f29a..d48327d6a 100644
--- a/src/threed/arrays/qcustomdataarray.cpp
+++ b/src/threed/arrays/qcustomdataarray.cpp
@@ -155,7 +155,7 @@ QCustomDataArray::QCustomDataArray(const QArray<QVector2D>& other)
if (size > 0) {
const QVector2D *src = other.constData();
float *dst = m_array.extend(size * 2);
- qMemCopy(dst, src, size * sizeof(QVector2D));
+ memcpy(dst, src, size * sizeof(QVector2D));
}
}
@@ -177,7 +177,7 @@ QCustomDataArray::QCustomDataArray(const QArray<QVector3D>& other)
if (size > 0) {
const QVector3D *src = other.constData();
float *dst = m_array.extend(size * 3);
- qMemCopy(dst, src, size * sizeof(QVector3D));
+ memcpy(dst, src, size * sizeof(QVector3D));
}
}
@@ -199,7 +199,7 @@ QCustomDataArray::QCustomDataArray(const QArray<QVector4D>& other)
if (size > 0) {
const QVector4D *src = other.constData();
float *dst = m_array.extend(size * 4);
- qMemCopy(dst, src, size * sizeof(QVector4D));
+ memcpy(dst, src, size * sizeof(QVector4D));
}
}
@@ -218,7 +218,7 @@ QCustomDataArray::QCustomDataArray(const QArray<QColor4ub>& other)
m_elementComponents(1)
{
int size = other.size();
- qMemCopy(m_array.extend(size), other.constData(), sizeof(QColor4ub) * size);
+ memcpy(m_array.extend(size), other.constData(), sizeof(QColor4ub) * size);
}
/*!
@@ -812,7 +812,7 @@ QArray<QVector2D> QCustomDataArray::toVector2DArray() const
if (size > 0) {
QVector2D *dst = result.extend(size);
const float *src = m_array.constData();
- qMemCopy(dst, src, size * sizeof(QVector2D));
+ memcpy(dst, src, size * sizeof(QVector2D));
}
return result;
}
@@ -834,7 +834,7 @@ QArray<QVector3D> QCustomDataArray::toVector3DArray() const
if (size > 0) {
QVector3D *dst = result.extend(size);
const float *src = m_array.constData();
- qMemCopy(dst, src, size * sizeof(QVector3D));
+ memcpy(dst, src, size * sizeof(QVector3D));
}
return result;
}
@@ -856,7 +856,7 @@ QArray<QVector4D> QCustomDataArray::toVector4DArray() const
if (size > 0) {
QVector4D *dst = result.extend(size);
const float *src = m_array.constData();
- qMemCopy(dst, src, size * sizeof(QVector4D));
+ memcpy(dst, src, size * sizeof(QVector4D));
}
return result;
}
diff --git a/src/threed/geometry/qgeometrydata.cpp b/src/threed/geometry/qgeometrydata.cpp
index c48bd0b2f..d4263dc13 100644
--- a/src/threed/geometry/qgeometrydata.cpp
+++ b/src/threed/geometry/qgeometrydata.cpp
@@ -164,8 +164,8 @@ QGeometryDataPrivate::QGeometryDataPrivate()
, boxValid(true)
, bufferStrategy(QGeometryData::BufferIfPossible | QGeometryData::KeepClientData)
{
- qMemSet(key, -1, ATTR_CNT);
- qMemSet(size, 0, ATTR_CNT);
+ memset(key, -1, ATTR_CNT);
+ memset(size, 0, ATTR_CNT);
}
QGeometryDataPrivate::~QGeometryDataPrivate()
@@ -187,8 +187,8 @@ QGeometryDataPrivate *QGeometryDataPrivate::clone() const
temp->modified = modified;
temp->bb = bb;
temp->fields = fields;
- qMemCopy(temp->key, key, ATTR_CNT);
- qMemCopy(temp->size, size, ATTR_CNT);
+ memcpy(temp->key, key, ATTR_CNT);
+ memcpy(temp->size, size, ATTR_CNT);
temp->count = count;
temp->reserved = reserved;
temp->boxValid = boxValid;