summaryrefslogtreecommitdiffstats
path: root/src/extras
diff options
context:
space:
mode:
authorAurélien Brooke <aurelien@bahiasoft.fr>2022-12-20 21:13:45 +0100
committerAurélien Brooke <aurelien@bahiasoft.fr>2022-12-21 17:31:36 +0100
commitb291ef7442453d3ea842756189413d9521029b1b (patch)
treed7f9466a3572f8d831c65ec3e9cd76298d038fb5 /src/extras
parent1acc6c9ce4fa5fe1c1b55edb7e86fe9cc000deea (diff)
Remove qsizetype to int narrowing conversions
Change the variable type from int to qsizetype when receiving qsizetype values. Change-Id: I2adf71e1d2f26b1452fee28890c0f68300f54224 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
Diffstat (limited to 'src/extras')
-rw-r--r--src/extras/3dtext/qextrudedtextgeometry.cpp2
-rw-r--r--src/extras/geometries/qcuboidgeometry.cpp2
-rw-r--r--src/extras/geometries/qplanegeometry.cpp2
-rw-r--r--src/extras/geometries/qspheregeometry.cpp2
-rw-r--r--src/extras/geometries/qtorusgeometry.cpp2
-rw-r--r--src/extras/text/qtextureatlas.cpp2
-rw-r--r--src/extras/text/qtextureatlas_p.h2
7 files changed, 7 insertions, 7 deletions
diff --git a/src/extras/3dtext/qextrudedtextgeometry.cpp b/src/extras/3dtext/qextrudedtextgeometry.cpp
index a15fc2b4b..ebe435f25 100644
--- a/src/extras/3dtext/qextrudedtextgeometry.cpp
+++ b/src/extras/3dtext/qextrudedtextgeometry.cpp
@@ -87,7 +87,7 @@ TriangulationData triangulate(const QString &text, const QFont &font)
// Append new triangles to result.vertices
result.vertices.reserve(size_t(triangles.vertices.size()) / 2);
- for (int i = 0, m = triangles.vertices.size(); i < m; i += 2)
+ for (qsizetype i = 0, m = triangles.vertices.size(); i < m; i += 2)
result.vertices.push_back(QVector3D(triangles.vertices[i] / font.pointSizeF(), triangles.vertices[i + 1] / font.pointSizeF(), 0.0f));
return result;
diff --git a/src/extras/geometries/qcuboidgeometry.cpp b/src/extras/geometries/qcuboidgeometry.cpp
index 954a5d39e..195f8075b 100644
--- a/src/extras/geometries/qcuboidgeometry.cpp
+++ b/src/extras/geometries/qcuboidgeometry.cpp
@@ -325,7 +325,7 @@ QByteArray createCuboidIndexData(const QSize &yzResolution,
const int yzIndices = 2 * 3 * (yzResolution.width() - 1) * (yzResolution.height() - 1);
const int xzIndices = 2 * 3 * (xzResolution.width() - 1) * (xzResolution.height() - 1);
const int xyIndices = 2 * 3 * (xyResolution.width() - 1) * (xyResolution.height() - 1);
- const int indexCount = 2 * (yzIndices + xzIndices + xyIndices);
+ const qsizetype indexCount = 2 * (yzIndices + xzIndices + xyIndices);
QByteArray indexData;
indexData.resize(indexCount * sizeof(quint16));
diff --git a/src/extras/geometries/qplanegeometry.cpp b/src/extras/geometries/qplanegeometry.cpp
index 6d0199e07..21be44f56 100644
--- a/src/extras/geometries/qplanegeometry.cpp
+++ b/src/extras/geometries/qplanegeometry.cpp
@@ -80,7 +80,7 @@ QByteArray createPlaneIndexData(const QSize &resolution)
{
// Create the index data. 2 triangles per rectangular face
const int faces = 2 * (resolution.width() - 1) * (resolution.height() - 1);
- const int indices = 3 * faces;
+ const qsizetype indices = 3 * faces;
Q_ASSERT(indices < std::numeric_limits<quint16>::max());
QByteArray indexBytes;
indexBytes.resize(indices * sizeof(quint16));
diff --git a/src/extras/geometries/qspheregeometry.cpp b/src/extras/geometries/qspheregeometry.cpp
index f078cd9ab..9fd99ea11 100644
--- a/src/extras/geometries/qspheregeometry.cpp
+++ b/src/extras/geometries/qspheregeometry.cpp
@@ -80,7 +80,7 @@ QByteArray createSphereMeshIndexData(int rings, int slices)
faces += 2 * slices; // tri per slice for both top and bottom
QByteArray indexBytes;
- const int indices = faces * 3;
+ const qsizetype indices = faces * 3;
Q_ASSERT(indices < 65536);
indexBytes.resize(indices * sizeof(quint16));
quint16 *indexPtr = reinterpret_cast<quint16*>(indexBytes.data());
diff --git a/src/extras/geometries/qtorusgeometry.cpp b/src/extras/geometries/qtorusgeometry.cpp
index 3e303953b..07a15b742 100644
--- a/src/extras/geometries/qtorusgeometry.cpp
+++ b/src/extras/geometries/qtorusgeometry.cpp
@@ -91,7 +91,7 @@ QByteArray createTorusIndexData(int requestedRings, int requestedSlices)
{
const int slices = requestedSlices + 1;
int triangles = triangleCount(requestedRings, requestedSlices);
- int indices = triangles * 3;
+ qsizetype indices = triangles * 3;
Q_ASSERT(indices < 65536);
QByteArray indexBytes;
indexBytes.resize(indices * sizeof(quint16));
diff --git a/src/extras/text/qtextureatlas.cpp b/src/extras/text/qtextureatlas.cpp
index b6319005d..85ed57d97 100644
--- a/src/extras/text/qtextureatlas.cpp
+++ b/src/extras/text/qtextureatlas.cpp
@@ -223,7 +223,7 @@ bool QTextureAtlas::hasImage(TextureId id) const
return d->m_textures.contains(id);
}
-int QTextureAtlas::imageCount() const
+qsizetype QTextureAtlas::imageCount() const
{
Q_D(const QTextureAtlas);
return d->m_textures.size();
diff --git a/src/extras/text/qtextureatlas_p.h b/src/extras/text/qtextureatlas_p.h
index c5e941b35..8d65b15fe 100644
--- a/src/extras/text/qtextureatlas_p.h
+++ b/src/extras/text/qtextureatlas_p.h
@@ -42,7 +42,7 @@ public:
TextureId addImage(const QImage &image, int padding);
void removeImage(TextureId id);
- int imageCount() const;
+ qsizetype imageCount() const;
bool hasImage(TextureId id) const;
QRect imagePosition(TextureId id) const;