From 503a45b2c1167c47594aab2d1442465aa521cccb Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Mon, 5 Aug 2013 22:12:40 -0700 Subject: [PATCH] Remove C-style casts from public headers. Task-number: QTBUG-32735 Change-Id: I14c313d17b80dce1826290ddd634f449b315190e Reviewed-by: Alan Alpert --- src/quick/scenegraph/coreapi/qsggeometry.h | 24 ++++++++++++------------ src/quick/scenegraph/util/qsgtexturematerial.h | 8 ++++---- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/quick/scenegraph/coreapi/qsggeometry.h b/src/quick/scenegraph/coreapi/qsggeometry.h index 78ad03e..f1d8c87 100644 --- a/src/quick/scenegraph/coreapi/qsggeometry.h +++ b/src/quick/scenegraph/coreapi/qsggeometry.h @@ -151,10 +151,10 @@ public: static void updateTexturedRectGeometry(QSGGeometry *g, const QRectF &rect, const QRectF &sourceRect); void setIndexDataPattern(DataPattern p); - DataPattern indexDataPattern() const { return (DataPattern) m_index_usage_pattern; } + DataPattern indexDataPattern() const { return DataPattern(m_index_usage_pattern); } void setVertexDataPattern(DataPattern p); - DataPattern vertexDataPattern() const { return (DataPattern) m_vertex_usage_pattern; } + DataPattern vertexDataPattern() const { return DataPattern(m_vertex_usage_pattern); } void markIndexDataDirty(); void markVertexDataDirty(); @@ -190,25 +190,25 @@ private: inline uint *QSGGeometry::indexDataAsUInt() { Q_ASSERT(m_index_type == GL_UNSIGNED_INT); - return (uint *) indexData(); + return static_cast(indexData()); } inline quint16 *QSGGeometry::indexDataAsUShort() { Q_ASSERT(m_index_type == GL_UNSIGNED_SHORT); - return (quint16 *) indexData(); + return static_cast(indexData()); } inline const uint *QSGGeometry::indexDataAsUInt() const { Q_ASSERT(m_index_type == GL_UNSIGNED_INT); - return (uint *) indexData(); + return static_cast(indexData()); } inline const quint16 *QSGGeometry::indexDataAsUShort() const { Q_ASSERT(m_index_type == GL_UNSIGNED_SHORT); - return (quint16 *) indexData(); + return static_cast(indexData()); } inline QSGGeometry::Point2D *QSGGeometry::vertexDataAsPoint2D() @@ -218,7 +218,7 @@ inline QSGGeometry::Point2D *QSGGeometry::vertexDataAsPoint2D() Q_ASSERT(m_attributes.attributes[0].tupleSize == 2); Q_ASSERT(m_attributes.attributes[0].type == GL_FLOAT); Q_ASSERT(m_attributes.attributes[0].position == 0); - return (Point2D *) m_data; + return static_cast(m_data); } inline QSGGeometry::TexturedPoint2D *QSGGeometry::vertexDataAsTexturedPoint2D() @@ -231,7 +231,7 @@ inline QSGGeometry::TexturedPoint2D *QSGGeometry::vertexDataAsTexturedPoint2D() Q_ASSERT(m_attributes.attributes[1].position == 1); Q_ASSERT(m_attributes.attributes[1].tupleSize == 2); Q_ASSERT(m_attributes.attributes[1].type == GL_FLOAT); - return (TexturedPoint2D *) m_data; + return static_cast(m_data); } inline QSGGeometry::ColoredPoint2D *QSGGeometry::vertexDataAsColoredPoint2D() @@ -244,7 +244,7 @@ inline QSGGeometry::ColoredPoint2D *QSGGeometry::vertexDataAsColoredPoint2D() Q_ASSERT(m_attributes.attributes[1].position == 1); Q_ASSERT(m_attributes.attributes[1].tupleSize == 4); Q_ASSERT(m_attributes.attributes[1].type == GL_UNSIGNED_BYTE); - return (ColoredPoint2D *) m_data; + return static_cast(m_data); } inline const QSGGeometry::Point2D *QSGGeometry::vertexDataAsPoint2D() const @@ -254,7 +254,7 @@ inline const QSGGeometry::Point2D *QSGGeometry::vertexDataAsPoint2D() const Q_ASSERT(m_attributes.attributes[0].tupleSize == 2); Q_ASSERT(m_attributes.attributes[0].type == GL_FLOAT); Q_ASSERT(m_attributes.attributes[0].position == 0); - return (const Point2D *) m_data; + return static_cast(m_data); } inline const QSGGeometry::TexturedPoint2D *QSGGeometry::vertexDataAsTexturedPoint2D() const @@ -267,7 +267,7 @@ inline const QSGGeometry::TexturedPoint2D *QSGGeometry::vertexDataAsTexturedPoin Q_ASSERT(m_attributes.attributes[1].position == 1); Q_ASSERT(m_attributes.attributes[1].tupleSize == 2); Q_ASSERT(m_attributes.attributes[1].type == GL_FLOAT); - return (const TexturedPoint2D *) m_data; + return static_cast(m_data); } inline const QSGGeometry::ColoredPoint2D *QSGGeometry::vertexDataAsColoredPoint2D() const @@ -280,7 +280,7 @@ inline const QSGGeometry::ColoredPoint2D *QSGGeometry::vertexDataAsColoredPoint2 Q_ASSERT(m_attributes.attributes[1].position == 1); Q_ASSERT(m_attributes.attributes[1].tupleSize == 4); Q_ASSERT(m_attributes.attributes[1].type == GL_UNSIGNED_BYTE); - return (const ColoredPoint2D *) m_data; + return static_cast(m_data); } int QSGGeometry::sizeOfIndex() const diff --git a/src/quick/scenegraph/util/qsgtexturematerial.h b/src/quick/scenegraph/util/qsgtexturematerial.h index b842779..ff7933e 100644 --- a/src/quick/scenegraph/util/qsgtexturematerial.h +++ b/src/quick/scenegraph/util/qsgtexturematerial.h @@ -60,16 +60,16 @@ public: QSGTexture *texture() const { return m_texture; } void setMipmapFiltering(QSGTexture::Filtering filteringType) { m_mipmap_filtering = filteringType; } - QSGTexture::Filtering mipmapFiltering() const { return (QSGTexture::Filtering) m_mipmap_filtering; } + QSGTexture::Filtering mipmapFiltering() const { return QSGTexture::Filtering(m_mipmap_filtering); } void setFiltering(QSGTexture::Filtering filteringType) { m_filtering = filteringType; } - QSGTexture::Filtering filtering() const { return (QSGTexture::Filtering) m_filtering; } + QSGTexture::Filtering filtering() const { return QSGTexture::Filtering(m_filtering); } void setHorizontalWrapMode(QSGTexture::WrapMode mode) { m_horizontal_wrap = mode; } - QSGTexture::WrapMode horizontalWrapMode() const { return (QSGTexture::WrapMode) m_horizontal_wrap; } + QSGTexture::WrapMode horizontalWrapMode() const { return QSGTexture::WrapMode(m_horizontal_wrap); } void setVerticalWrapMode(QSGTexture::WrapMode mode) { m_vertical_wrap = mode; } - QSGTexture::WrapMode verticalWrapMode() const { return (QSGTexture::WrapMode) m_vertical_wrap; } + QSGTexture::WrapMode verticalWrapMode() const { return QSGTexture::WrapMode(m_vertical_wrap); } protected: QSGTexture *m_texture; -- 2.7.4