summaryrefslogtreecommitdiffstats
path: root/src
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
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')
-rw-r--r--src/animation/backend/additiveclipblend.cpp4
-rw-r--r--src/animation/backend/animationclip.cpp26
-rw-r--r--src/animation/backend/animationclip_p.h10
-rw-r--r--src/animation/backend/animationutils.cpp46
-rw-r--r--src/animation/backend/animationutils_p.h24
-rw-r--r--src/animation/backend/buildblendtreesjob.cpp6
-rw-r--r--src/animation/backend/clipblendnode.cpp6
-rw-r--r--src/animation/backend/fcurve.cpp8
-rw-r--r--src/animation/backend/fcurve_p.h2
-rw-r--r--src/animation/backend/functionrangefinder.cpp14
-rw-r--r--src/animation/backend/functionrangefinder_p.h2
-rw-r--r--src/animation/backend/gltfimporter.cpp24
-rw-r--r--src/animation/backend/gltfimporter_p.h8
-rw-r--r--src/animation/backend/handler.cpp16
-rw-r--r--src/animation/backend/lerpclipblend.cpp4
-rw-r--r--src/core/aspects/aspectcommanddebugger_p.h6
-rw-r--r--src/core/geometry/qbuffer_p.h2
-rw-r--r--src/core/services/qsysteminformationservice.cpp2
-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
-rw-r--r--src/plugins/geometryloaders/default/objgeometryloader.cpp4
-rw-r--r--src/plugins/renderers/opengl/graphicshelpers/submissioncontext.cpp4
-rw-r--r--src/plugins/renderers/opengl/renderer/frameprofiler_p.h4
-rw-r--r--src/plugins/renderers/rhi/graphicshelpers/submissioncontext.cpp18
-rw-r--r--src/plugins/renderers/rhi/renderer/rhishader.cpp2
-rw-r--r--src/render/geometry/skeleton_p.h2
-rw-r--r--src/render/jobs/filterlayerentityjob.cpp2
-rw-r--r--src/render/jobs/loadskeletonjob.cpp8
-rw-r--r--src/render/jobs/updatelevelofdetailjob.cpp8
-rw-r--r--src/render/materialsystem/qshaderprogram.cpp6
-rw-r--r--src/render/shadergraph/qshadergenerator.cpp8
36 files changed, 145 insertions, 145 deletions
diff --git a/src/animation/backend/additiveclipblend.cpp b/src/animation/backend/additiveclipblend.cpp
index 208e2d106..5cccafe02 100644
--- a/src/animation/backend/additiveclipblend.cpp
+++ b/src/animation/backend/additiveclipblend.cpp
@@ -39,10 +39,10 @@ ClipResults AdditiveClipBlend::doBlend(const QList<ClipResults> &blendData) cons
{
Q_ASSERT(blendData.size() == 2);
Q_ASSERT(blendData[0].size() == blendData[1].size());
- const int elementCount = blendData.first().size();
+ const qsizetype elementCount = blendData.first().size();
ClipResults blendResults(elementCount);
- for (int i = 0; i < elementCount; ++i)
+ for (qsizetype i = 0; i < elementCount; ++i)
blendResults[i] = blendData[0][i] + m_additiveFactor * blendData[1][i];
return blendResults;
diff --git a/src/animation/backend/animationclip.cpp b/src/animation/backend/animationclip.cpp
index bf036ca0f..e00aa1df8 100644
--- a/src/animation/backend/animationclip.cpp
+++ b/src/animation/backend/animationclip.cpp
@@ -201,7 +201,7 @@ void AnimationClip::loadAnimationFromUrl()
// TODO: Allow loading of a named animation from a file containing many
const QJsonArray animationsArray = rootObject[QLatin1String("animations")].toArray();
qCDebug(Jobs) << "Found" << animationsArray.size() << "animations:";
- for (int i = 0; i < animationsArray.size(); ++i) {
+ for (qsizetype i = 0; i < animationsArray.size(); ++i) {
QJsonObject animation = animationsArray.at(i).toObject();
qCDebug(Jobs) << "Animation Name:" << animation[QLatin1String("animationName")].toString();
}
@@ -218,7 +218,7 @@ void AnimationClip::loadAnimationFromUrl()
} else if (animationIndex < 0 && !animationName.isEmpty()) {
// Can we find an animation of the correct name?
bool foundAnimation = false;
- for (int i = 0; i < animationsArray.size(); ++i) {
+ for (qsizetype i = 0; i < animationsArray.size(); ++i) {
if (animationsArray.at(i)[ANIMATION_NAME_KEY].toString() == animationName) {
animationIndex = i;
foundAnimation = true;
@@ -241,9 +241,9 @@ void AnimationClip::loadAnimationFromUrl()
m_name = animation[QLatin1String("animationName")].toString();
QJsonArray channelsArray = animation[QLatin1String("channels")].toArray();
- const int channelCount = channelsArray.size();
+ const qsizetype channelCount = channelsArray.size();
m_channels.resize(channelCount);
- for (int i = 0; i < channelCount; ++i) {
+ for (qsizetype i = 0; i < channelCount; ++i) {
const QJsonObject group = channelsArray.at(i).toObject();
m_channels[i].read(group);
}
@@ -257,7 +257,7 @@ void AnimationClip::loadAnimationFromData()
{
// Reformat data from QAnimationClipData to backend format
m_channels.resize(m_clipData.channelCount());
- int i = 0;
+ qsizetype i = 0;
for (const auto &frontendChannel : std::as_const(m_clipData))
m_channels[i++].setFromQChannel(frontendChannel);
}
@@ -282,10 +282,10 @@ void AnimationClip::setDuration(float duration)
m_duration = duration;
}
-int AnimationClip::channelIndex(const QString &channelName, int jointIndex) const
+qsizetype AnimationClip::channelIndex(const QString &channelName, qsizetype jointIndex) const
{
- const int channelCount = m_channels.size();
- for (int i = 0; i < channelCount; ++i) {
+ const qsizetype channelCount = m_channels.size();
+ for (qsizetype i = 0; i < channelCount; ++i) {
if (m_channels[i].name == channelName
&& (jointIndex == -1 || m_channels[i].jointIndex == jointIndex)) {
return i;
@@ -304,10 +304,10 @@ int AnimationClip::channelIndex(const QString &channelName, int jointIndex) cons
for the first group, so the first channel of the second group occurs
at index 3.
*/
-int AnimationClip::channelComponentBaseIndex(int channelIndex) const
+qsizetype AnimationClip::channelComponentBaseIndex(qsizetype channelIndex) const
{
- int index = 0;
- for (int i = 0; i < channelIndex; ++i)
+ qsizetype index = 0;
+ for (qsizetype i = 0; i < channelIndex; ++i)
index += m_channels[i].channelComponents.size();
return index;
}
@@ -332,9 +332,9 @@ float AnimationClip::findDuration()
return tMax;
}
-int AnimationClip::findChannelComponentCount()
+qsizetype AnimationClip::findChannelComponentCount()
{
- int channelCount = 0;
+ qsizetype channelCount = 0;
for (const Channel &channel : std::as_const(m_channels))
channelCount += channel.channelComponents.size();
return channelCount;
diff --git a/src/animation/backend/animationclip_p.h b/src/animation/backend/animationclip_p.h
index 8bf6bfa49..6d4144feb 100644
--- a/src/animation/backend/animationclip_p.h
+++ b/src/animation/backend/animationclip_p.h
@@ -51,9 +51,9 @@ public:
void loadAnimation();
void setDuration(float duration);
float duration() const { return m_duration; }
- int channelIndex(const QString &channelName, int jointIndex) const;
- int channelCount() const { return m_channelComponentCount; }
- int channelComponentBaseIndex(int channelGroupIndex) const;
+ qsizetype channelIndex(const QString &channelName, qsizetype jointIndex) const;
+ qsizetype channelCount() const { return m_channelComponentCount; }
+ qsizetype channelComponentBaseIndex(qsizetype channelGroupIndex) const;
// Allow unit tests to set the data type
#if !defined(QT_BUILD_INTERNAL)
@@ -74,7 +74,7 @@ private:
void loadAnimationFromData();
void clearData();
float findDuration();
- int findChannelComponentCount();
+ qsizetype findChannelComponentCount();
QMutex m_mutex;
@@ -86,7 +86,7 @@ private:
QString m_name;
QVector<Channel> m_channels;
float m_duration;
- int m_channelComponentCount;
+ qsizetype m_channelComponentCount;
Qt3DCore::QNodeIdVector m_dependingAnimators;
Qt3DCore::QNodeIdVector m_dependingBlendedAnimators;
diff --git a/src/animation/backend/animationutils.cpp b/src/animation/backend/animationutils.cpp
index 0892afe21..edbed919b 100644
--- a/src/animation/backend/animationutils.cpp
+++ b/src/animation/backend/animationutils.cpp
@@ -121,8 +121,8 @@ double phaseFromElapsedTime(double t_current_local,
*/
ComponentIndices channelComponentsToIndices(const Channel &channel,
int dataType,
- int expectedComponentCount,
- int offset)
+ qsizetype expectedComponentCount,
+ qsizetype offset)
{
static const QList<char> standardSuffixes = { 'X', 'Y', 'Z', 'W' };
static const QList<char> quaternionSuffixes = { 'W', 'X', 'Y', 'Z' };
@@ -147,11 +147,11 @@ ComponentIndices channelComponentsToIndices(const Channel &channel,
}
ComponentIndices channelComponentsToIndicesHelper(const Channel &channel,
- int expectedComponentCount,
- int offset,
+ qsizetype expectedComponentCount,
+ qsizetype offset,
const QList<char> &suffixes)
{
- const int actualComponentCount = int(channel.channelComponents.size());
+ const qsizetype actualComponentCount = channel.channelComponents.size();
if (actualComponentCount != expectedComponentCount) {
qWarning() << "Data type expects" << expectedComponentCount
<< "but found" << actualComponentCount << "components in the animation clip";
@@ -162,7 +162,7 @@ ComponentIndices channelComponentsToIndicesHelper(const Channel &channel,
// Generate the set of channel suffixes
QList<char> channelSuffixes;
channelSuffixes.reserve(expectedComponentCount);
- for (int i = 0; i < expectedComponentCount; ++i) {
+ for (qsizetype i = 0; i < expectedComponentCount; ++i) {
const QString &componentName = channel.channelComponents[i].name;
// An unset component name indicates that the no mapping is necessary
@@ -181,8 +181,8 @@ ComponentIndices channelComponentsToIndicesHelper(const Channel &channel,
return indices;
// Find index of standard index in channel indexes
- for (int i = 0; i < expectedComponentCount; ++i) {
- int index = channelSuffixes.indexOf(suffixes[i]);
+ for (qsizetype i = 0; i < expectedComponentCount; ++i) {
+ qsizetype index = channelSuffixes.indexOf(suffixes[i]);
if (index != -1)
indices[i] = index + offset;
else
@@ -509,7 +509,7 @@ QVector<MappingData> buildPropertyMappings(const QVector<ChannelMapping *> &chan
mapping->componentCount(),
mapping->peerId()
};
- const int index = channelNamesAndTypes.indexOf(nameAndType);
+ const qsizetype index = channelNamesAndTypes.indexOf(nameAndType);
if (index != -1) {
// Do we have any animation data for this channel? If not, don't bother
// adding a mapping for it.
@@ -541,15 +541,15 @@ QVector<MappingData> buildPropertyMappings(const QVector<ChannelMapping *> &chan
mappingData.targetId = mapping->skeletonId();
mappingData.skeleton = mapping->skeleton();
- const int propertyCount = jointProperties.size();
- for (int propertyIndex = 0; propertyIndex < propertyCount; ++propertyIndex) {
+ const qsizetype propertyCount = jointProperties.size();
+ for (qsizetype propertyIndex = 0; propertyIndex < propertyCount; ++propertyIndex) {
// Get the name, type and index
ChannelNameAndType nameAndType = jointProperties[propertyIndex];
nameAndType.jointIndex = jointIndex;
nameAndType.mappingId = mapping->peerId();
// Try to find matching channel name and type
- const int index = channelNamesAndTypes.indexOf(nameAndType);
+ const qsizetype index = channelNamesAndTypes.indexOf(nameAndType);
if (index == -1)
continue;
@@ -635,7 +635,7 @@ QVector<ChannelNameAndType> buildRequiredChannelsAndTypes(Handler *handler,
Skeleton *skeleton = handler->skeletonManager()->lookupResource(mapping->skeletonId());
const int jointCount = skeleton->jointCount();
for (int jointIndex = 0; jointIndex < jointCount; ++jointIndex) {
- const int propertyCount = jointProperties.size();
+ const qsizetype propertyCount = jointProperties.size();
for (int propertyIndex = 0; propertyIndex < propertyCount; ++propertyIndex) {
// Get the name, type and index
ChannelNameAndType nameAndType = jointProperties[propertyIndex];
@@ -724,12 +724,12 @@ ClipFormat generateClipFormatIndices(const QVector<ChannelNameAndType> &targetCh
Q_ASSERT(targetChannels.size() == targetIndices.size());
// Reserve enough storage for all the format indices
- const int channelCount = targetChannels.size();
+ const qsizetype channelCount = targetChannels.size();
ClipFormat f;
f.namesAndTypes.resize(channelCount);
f.formattedComponentIndices.resize(channelCount);
f.sourceClipMask.resize(channelCount);
- int indexCount = 0;
+ qsizetype indexCount = 0;
for (const auto &targetIndexVec : std::as_const(targetIndices))
indexCount += targetIndexVec.size();
ComponentIndices &sourceIndices = f.sourceClipIndices;
@@ -737,18 +737,18 @@ ClipFormat generateClipFormatIndices(const QVector<ChannelNameAndType> &targetCh
// Iterate through the target channels
auto formatIt = sourceIndices.begin();
- for (int i = 0; i < channelCount; ++i) {
+ for (qsizetype i = 0; i < channelCount; ++i) {
// Find the index of the channel from the clip
const ChannelNameAndType &targetChannel = targetChannels[i];
- const int clipChannelIndex = clip->channelIndex(targetChannel.name,
- targetChannel.jointIndex);
- const int componentCount = targetIndices[i].size();
+ const qsizetype clipChannelIndex = clip->channelIndex(targetChannel.name,
+ targetChannel.jointIndex);
+ const qsizetype componentCount = targetIndices[i].size();
if (clipChannelIndex != -1) {
// Found a matching channel in the clip. Populate the corresponding
// entries in the format vector with the *source indices*
// needed to build the formatted results.
- const int baseIndex = clip->channelComponentBaseIndex(clipChannelIndex);
+ const qsizetype baseIndex = clip->channelComponentBaseIndex(clipChannelIndex);
const auto channelIndices = channelComponentsToIndices(clip->channels()[clipChannelIndex],
targetChannel.type,
targetChannel.componentCount,
@@ -756,7 +756,7 @@ ClipFormat generateClipFormatIndices(const QVector<ChannelNameAndType> &targetCh
std::copy(channelIndices.begin(), channelIndices.end(), formatIt);
f.sourceClipMask[i].resize(componentCount);
- for (int j = 0; j < componentCount; ++j)
+ for (qsizetype j = 0; j < componentCount; ++j)
f.sourceClipMask[i].setBit(j, channelIndices[j] != -1);
} else {
// No such channel in this clip. We'll use default values when
@@ -777,7 +777,7 @@ ClipResults formatClipResults(const ClipResults &rawClipResults,
const ComponentIndices &format)
{
// Resize the output to match the number of indices
- const int elementCount = format.size();
+ const qsizetype elementCount = format.size();
ClipResults formattedClipResults(elementCount);
// Perform a gather operation to format the data
@@ -787,7 +787,7 @@ ClipResults formatClipResults(const ClipResults &rawClipResults,
// TODO: We could potentially avoid having holes in these intermediate
// vectors by adjusting the component indices stored in the MappingData
// and format vectors. Needs careful investigation!
- for (int i = 0; i < elementCount; ++i) {
+ for (qsizetype i = 0; i < elementCount; ++i) {
if (format[i] == -1)
continue;
formattedClipResults[i] = rawClipResults[format[i]];
diff --git a/src/animation/backend/animationutils_p.h b/src/animation/backend/animationutils_p.h
index 1cd82ad83..fdeac07e6 100644
--- a/src/animation/backend/animationutils_p.h
+++ b/src/animation/backend/animationutils_p.h
@@ -39,7 +39,7 @@ class AnimationClip;
class ChannelMapper;
class ChannelMapping;
-using ComponentIndices = QVector<int>;
+using ComponentIndices = QVector<qsizetype>;
enum JointTransformComponent {
NoTransformComponent = 0,
@@ -99,10 +99,10 @@ struct ChannelNameAndType
QString jointName;
QString name;
int type;
- int jointIndex;
+ qsizetype jointIndex;
Qt3DCore::QNodeId mappingId;
JointTransformComponent jointTransformComponent;
- int componentCount;
+ qsizetype componentCount;
static const int invalidIndex = -1;
@@ -182,7 +182,7 @@ inline QDebug operator<<(QDebug dbg, const ChannelNameAndType &nameAndType)
struct ComponentValue
{
- int componentIndex;
+ qsizetype componentIndex;
float value;
};
QT3D_DECLARE_TYPEINFO_2(Qt3DAnimation, Animation, ComponentValue, Q_PRIMITIVE_TYPE)
@@ -203,18 +203,18 @@ struct ClipFormat
inline QDebug operator<<(QDebug dbg, const ClipFormat &format)
{
QDebugStateSaver saver(dbg);
- int sourceIndex = 0;
- for (int i = 0; i < format.namesAndTypes.size(); ++i) {
+ qsizetype sourceIndex = 0;
+ for (qsizetype i = 0; i < format.namesAndTypes.size(); ++i) {
dbg << i
<< format.namesAndTypes[i].jointIndex
<< format.namesAndTypes[i].jointName
<< format.namesAndTypes[i].name
<< format.namesAndTypes[i].type
<< "formatted results dst indices =" << format.formattedComponentIndices[i];
- const int componentCount = format.formattedComponentIndices[i].size();
+ const qsizetype componentCount = format.formattedComponentIndices[i].size();
dbg << "clip src indices =";
- for (int j = sourceIndex; j < sourceIndex + componentCount; ++j)
+ for (qsizetype j = sourceIndex; j < sourceIndex + componentCount; ++j)
dbg << format.sourceClipIndices[j] << "";
dbg << "src clip mask =" << format.sourceClipMask[i];
@@ -308,13 +308,13 @@ ClipEvaluationData evaluationDataForClip(AnimationClip *clip,
Q_AUTOTEST_EXPORT
ComponentIndices channelComponentsToIndices(const Channel &channel,
int dataType,
- int expectedComponentCount,
- int offset);
+ qsizetype expectedComponentCount,
+ qsizetype offset);
Q_AUTOTEST_EXPORT
ComponentIndices channelComponentsToIndicesHelper(const Channel &channelGroup,
- int expectedComponentCount,
- int offset,
+ qsizetype expectedComponentCount,
+ qsizetype offset,
const QList<char> &suffixes);
Q_AUTOTEST_EXPORT
diff --git a/src/animation/backend/buildblendtreesjob.cpp b/src/animation/backend/buildblendtreesjob.cpp
index 4d7eb0ebf..90030f4cb 100644
--- a/src/animation/backend/buildblendtreesjob.cpp
+++ b/src/animation/backend/buildblendtreesjob.cpp
@@ -125,8 +125,8 @@ void BuildBlendTreesJob::run()
for (const auto valueNode : valueNodes) {
ClipFormat &f = valueNode->clipFormat(blendClipAnimator->peerId());
- const int channelCount = blendTreeChannelMask.size();
- for (int i = 0; i < channelCount; ++i) {
+ const qsizetype channelCount = blendTreeChannelMask.size();
+ for (qsizetype i = 0; i < channelCount; ++i) {
if (blendTreeChannelMask[i] == f.sourceClipMask[i])
continue; // Masks match, nothing to do
@@ -140,7 +140,7 @@ void BuildBlendTreesJob::run()
// values and store them in the format.
const ComponentIndices &componentIndices = f.formattedComponentIndices[i];
Q_ASSERT(componentIndices.size() == defaultValue.size());
- for (int j = 0; j < defaultValue.size(); ++j)
+ for (qsizetype j = 0; j < defaultValue.size(); ++j)
f.defaultComponentValues.push_back({componentIndices[j], defaultValue[j]});
}
}
diff --git a/src/animation/backend/clipblendnode.cpp b/src/animation/backend/clipblendnode.cpp
index 830a08c11..78216f559 100644
--- a/src/animation/backend/clipblendnode.cpp
+++ b/src/animation/backend/clipblendnode.cpp
@@ -34,7 +34,7 @@ ClipBlendNode::BlendType Animation::ClipBlendNode::blendType() const
void ClipBlendNode::setClipResults(Qt3DCore::QNodeId animatorId, const ClipResults &clipResults)
{
// Do we already have an entry for this animator?
- const int animatorIndex = m_animatorIds.indexOf(animatorId);
+ const qsizetype animatorIndex = m_animatorIds.indexOf(animatorId);
if (animatorIndex == -1) {
// Nope, add it
m_animatorIds.push_back(animatorId);
@@ -46,7 +46,7 @@ void ClipBlendNode::setClipResults(Qt3DCore::QNodeId animatorId, const ClipResul
ClipResults ClipBlendNode::clipResults(Qt3DCore::QNodeId animatorId) const
{
- const int animatorIndex = m_animatorIds.indexOf(animatorId);
+ const qsizetype animatorIndex = m_animatorIds.indexOf(animatorId);
if (animatorIndex != -1)
return m_clipResults[animatorIndex];
return ClipResults();
@@ -98,7 +98,7 @@ void ClipBlendNode::blend(Qt3DCore::QNodeId animatorId)
{
// Obtain the clip results from each of the dependencies
const QList<Qt3DCore::QNodeId> dependencyNodeIds = currentDependencyIds();
- const int dependencyCount = dependencyNodeIds.size();
+ const qsizetype dependencyCount = dependencyNodeIds.size();
QList<ClipResults> blendData;
blendData.reserve(dependencyCount);
for (const auto &dependencyId : dependencyNodeIds) {
diff --git a/src/animation/backend/fcurve.cpp b/src/animation/backend/fcurve.cpp
index 949403f4c..9d7d60a03 100644
--- a/src/animation/backend/fcurve.cpp
+++ b/src/animation/backend/fcurve.cpp
@@ -136,7 +136,7 @@ void FCurve::read(const QJsonObject &json)
clearKeyframes();
const QJsonArray keyframeArray = json[QLatin1String("keyFrames")].toArray();
- const int keyframeCount = keyframeArray.size();
+ const qsizetype keyframeCount = keyframeArray.size();
for (int i = 0; i < keyframeCount; ++i) {
const QJsonObject keyframeData = keyframeArray.at(i).toObject();
@@ -208,10 +208,10 @@ void Channel::read(const QJsonObject &json)
if (!jointIndexValue.isUndefined())
jointIndex = jointIndexValue.toInt();
const QJsonArray channelComponentsArray = json[QLatin1String("channelComponents")].toArray();
- const int channelCount = channelComponentsArray.size();
+ const qsizetype channelCount = channelComponentsArray.size();
channelComponents.resize(channelCount);
- for (int i = 0; i < channelCount; ++i) {
+ for (qsizetype i = 0; i < channelCount; ++i) {
const QJsonObject channel = channelComponentsArray.at(i).toObject();
channelComponents[i].read(channel);
}
@@ -222,7 +222,7 @@ void Channel::setFromQChannel(const QChannel &qch)
name = qch.name();
jointIndex = qch.jointIndex();
channelComponents.resize(qch.channelComponentCount());
- int i = 0;
+ qsizetype i = 0;
for (const auto &frontendChannelComponent : qch)
channelComponents[i++].setFromQChannelComponent(frontendChannelComponent);
}
diff --git a/src/animation/backend/fcurve_p.h b/src/animation/backend/fcurve_p.h
index 4b5491a80..1ff65e5c2 100644
--- a/src/animation/backend/fcurve_p.h
+++ b/src/animation/backend/fcurve_p.h
@@ -115,7 +115,7 @@ inline QDebug operator<<(QDebug dbg, const ChannelComponent &channelComponent)
struct Channel
{
QString name;
- int jointIndex = -1;
+ qsizetype jointIndex = -1;
QVector<ChannelComponent> channelComponents;
void read(const QJsonObject &json);
diff --git a/src/animation/backend/functionrangefinder.cpp b/src/animation/backend/functionrangefinder.cpp
index a9b4972db..e374ea08c 100644
--- a/src/animation/backend/functionrangefinder.cpp
+++ b/src/animation/backend/functionrangefinder.cpp
@@ -58,10 +58,10 @@ int FunctionRangeFinder::locate(float x) const
if (m_x->size() < 2 || m_rangeSize < 2 || m_rangeSize > m_x->size())
return -1;
- int jLower = 0;
- int jUpper = m_x->size() - 1;
+ qsizetype jLower = 0;
+ qsizetype jUpper = m_x->size() - 1;
while (jUpper - jLower > 1) {
- int jMid = (jUpper + jLower) >> 1;
+ qsizetype jMid = (jUpper + jLower) >> 1;
if ((x >= m_x->at(jMid)) == m_ascending)
jLower = jMid;
else
@@ -83,14 +83,14 @@ int FunctionRangeFinder::hunt(float x) const
if (m_x->size() < 2 || m_rangeSize < 2 || m_rangeSize > m_x->size())
return -1;
- int jLower = m_previousLowerBound;
- int jMid;
- int jUpper;
+ qsizetype jLower = m_previousLowerBound;
+ qsizetype jMid;
+ qsizetype jUpper;
if (jLower < 0 || jLower > (m_x->size() - 1)) {
jLower = 0;
jUpper = m_x->size() - 1;
} else {
- int increment = 1;
+ qsizetype increment = 1;
if ((x >= m_x->at(jLower)) == m_ascending) {
for (;;) {
jUpper = jLower + increment;
diff --git a/src/animation/backend/functionrangefinder_p.h b/src/animation/backend/functionrangefinder_p.h
index 9d65d17a3..22d608f42 100644
--- a/src/animation/backend/functionrangefinder_p.h
+++ b/src/animation/backend/functionrangefinder_p.h
@@ -49,7 +49,7 @@ private:
int hunt(float x) const;
QList<float> *m_x;
- mutable int m_previousLowerBound;
+ mutable qsizetype m_previousLowerBound;
mutable bool m_correlated;
int m_rangeSize;
int m_correlationThreshold;
diff --git a/src/animation/backend/gltfimporter.cpp b/src/animation/backend/gltfimporter.cpp
index 975bd747f..469b82298 100644
--- a/src/animation/backend/gltfimporter.cpp
+++ b/src/animation/backend/gltfimporter.cpp
@@ -418,17 +418,17 @@ bool GLTFImporter::load(QIODevice *ioDev)
return parse();
}
-QHash<int, int> GLTFImporter::createNodeIndexToJointIndexMap(const Skin &skin) const
+QHash<qsizetype, qsizetype> GLTFImporter::createNodeIndexToJointIndexMap(const Skin &skin) const
{
- const int jointCount = skin.jointNodeIndices.size();
- QHash<int, int> nodeIndexToJointIndexMap;
+ const qsizetype jointCount = skin.jointNodeIndices.size();
+ QHash<qsizetype, qsizetype> nodeIndexToJointIndexMap;
nodeIndexToJointIndexMap.reserve(jointCount);
- for (int i = 0; i < jointCount; ++i)
+ for (qsizetype i = 0; i < jointCount; ++i)
nodeIndexToJointIndexMap.insert(skin.jointNodeIndices[i], i);
return nodeIndexToJointIndexMap;
}
-GLTFImporter::AnimationNameAndChannels GLTFImporter::createAnimationData(int animationIndex, const QString &animationName) const
+GLTFImporter::AnimationNameAndChannels GLTFImporter::createAnimationData(qsizetype animationIndex, const QString &animationName) const
{
AnimationNameAndChannels nameAndChannels;
if (m_animations.isEmpty()) {
@@ -439,7 +439,7 @@ GLTFImporter::AnimationNameAndChannels GLTFImporter::createAnimationData(int ani
if (m_animations.size() == 1) {
animationIndex = 0;
} else if (animationIndex < 0 && !animationName.isEmpty()) {
- for (int i = 0; i < m_animations.size(); ++i) {
+ for (qsizetype i = 0; i < m_animations.size(); ++i) {
if (m_animations[i].name == animationName) {
animationIndex = i;
break;
@@ -455,7 +455,7 @@ GLTFImporter::AnimationNameAndChannels GLTFImporter::createAnimationData(int ani
nameAndChannels.name = animation.name;
// Create node index to joint index lookup tables for each skin
- QList<QHash<int, int>> nodeIndexToJointIndexMaps;
+ QList<QHash<qsizetype, qsizetype>> nodeIndexToJointIndexMaps;
nodeIndexToJointIndexMaps.reserve(m_skins.size());
for (const auto &skin : m_skins)
nodeIndexToJointIndexMaps.push_back(createNodeIndexToJointIndexMap(skin));
@@ -468,7 +468,7 @@ GLTFImporter::AnimationNameAndChannels GLTFImporter::createAnimationData(int ani
// Find the node index to joint index map that contains the target node and
// look up the joint index from it. If no such map is found, the target joint
// is not part of a skeleton and so we can just set the jointIndex to -1.
- int jointIndex = -1;
+ qsizetype jointIndex = -1;
for (const auto &map : nodeIndexToJointIndexMaps) {
const auto result = map.find(channel.targetNodeIndex);
if (result != map.cend()) {
@@ -606,7 +606,7 @@ GLTFImporter::RawData GLTFImporter::accessorData(int accessorIndex, int index) c
const char *rawData = ba.constData() + bufferView.byteOffset + accessor.byteOffset;
const uint typeSize = accessorTypeSize(accessor.type);
- const int stride = (accessor.byteStride == 0)
+ const qsizetype stride = (accessor.byteStride == 0)
? accessor.dataSize * typeSize
: accessor.byteStride;
@@ -791,10 +791,10 @@ bool GLTFImporter::processJSONNode(const QJsonObject &json)
void GLTFImporter::setupNodeParentLinks()
{
- const int nodeCount = m_nodes.size();
- for (int i = 0; i < nodeCount; ++i) {
+ const qsizetype nodeCount = m_nodes.size();
+ for (qsizetype i = 0; i < nodeCount; ++i) {
const Node &node = m_nodes[i];
- const QList<int> &childNodeIndices = node.childNodeIndices;
+ const QList<qsizetype> &childNodeIndices = node.childNodeIndices;
for (const auto childNodeIndex : childNodeIndices) {
Q_ASSERT(childNodeIndex < m_nodes.size());
Node &childNode = m_nodes[childNodeIndex];
diff --git a/src/animation/backend/gltfimporter_p.h b/src/animation/backend/gltfimporter_p.h
index 1c1804e7f..7bcc2171f 100644
--- a/src/animation/backend/gltfimporter_p.h
+++ b/src/animation/backend/gltfimporter_p.h
@@ -84,7 +84,7 @@ public:
QString name;
int inverseBindAccessorIndex;
- QList<int> jointNodeIndices;
+ QList<qsizetype> jointNodeIndices;
};
class Channel
@@ -136,7 +136,7 @@ public:
explicit Node(const QJsonObject &json);
Qt3DCore::Sqt localTransform;
- QList<int> childNodeIndices;
+ QList<qsizetype> childNodeIndices;
QString name;
int parentNodeIndex;
int cameraIndex;
@@ -154,7 +154,7 @@ public:
QString name;
QVector<Qt3DAnimation::Animation::Channel> channels;
};
- AnimationNameAndChannels createAnimationData(int animationIndex, const QString &animationName = QString()) const;
+ AnimationNameAndChannels createAnimationData(qsizetype animationIndex, const QString &animationName = QString()) const;
private:
static Qt3DCore::QAttribute::VertexBaseType accessorTypeFromJSON(int componentType);
@@ -173,7 +173,7 @@ private:
bool parse();
bool parseGLTF2();
void cleanup();
- QHash<int, int> createNodeIndexToJointIndexMap(const Skin &skin) const;
+ QHash<qsizetype, qsizetype> createNodeIndexToJointIndexMap(const Skin &skin) const;
bool processJSONBuffer(const QJsonObject &json);
bool processJSONBufferView(const QJsonObject &json);
diff --git a/src/animation/backend/handler.cpp b/src/animation/backend/handler.cpp
index 15f761ad8..8bdbcbeff 100644
--- a/src/animation/backend/handler.cpp
+++ b/src/animation/backend/handler.cpp
@@ -200,18 +200,18 @@ std::vector<Qt3DCore::QAspectJobPtr> Handler::jobsToExecute(qint64 time)
qCDebug(HandlerLogic) << "Added EvaluateClipAnimatorJobs";
// Ensure we have a job per clip animator
- const int oldSize = m_evaluateClipAnimatorJobs.size();
- const int newSize = m_runningClipAnimators.size();
+ const qsizetype oldSize = m_evaluateClipAnimatorJobs.size();
+ const qsizetype newSize = m_runningClipAnimators.size();
if (oldSize < newSize) {
m_evaluateClipAnimatorJobs.resize(newSize);
- for (int i = oldSize; i < newSize; ++i) {
+ for (qsizetype i = oldSize; i < newSize; ++i) {
m_evaluateClipAnimatorJobs[i] = QSharedPointer<EvaluateClipAnimatorJob>::create();
m_evaluateClipAnimatorJobs[i]->setHandler(this);
}
}
// Set each job up with an animator to process and set dependencies
- for (int i = 0; i < newSize; ++i) {
+ for (qsizetype i = 0; i < newSize; ++i) {
m_evaluateClipAnimatorJobs[i]->setClipAnimator(m_runningClipAnimators[i]);
Qt3DCore::QAspectJobPrivate::get(m_evaluateClipAnimatorJobs[i].data())->clearDependencies();
if (hasLoadAnimationClipJob)
@@ -226,18 +226,18 @@ std::vector<Qt3DCore::QAspectJobPtr> Handler::jobsToExecute(qint64 time)
cleanupHandleList(&m_runningBlendedClipAnimators);
if (!m_runningBlendedClipAnimators.isEmpty()) {
// Ensure we have a job per clip animator
- const int oldSize = m_evaluateBlendClipAnimatorJobs.size();
- const int newSize = m_runningBlendedClipAnimators.size();
+ const qsizetype oldSize = m_evaluateBlendClipAnimatorJobs.size();
+ const qsizetype newSize = m_runningBlendedClipAnimators.size();
if (oldSize < newSize) {
m_evaluateBlendClipAnimatorJobs.resize(newSize);
- for (int i = oldSize; i < newSize; ++i) {
+ for (qsizetype i = oldSize; i < newSize; ++i) {
m_evaluateBlendClipAnimatorJobs[i] = QSharedPointer<EvaluateBlendClipAnimatorJob>::create();
m_evaluateBlendClipAnimatorJobs[i]->setHandler(this);
}
}
// Set each job up with an animator to process and set dependencies
- for (int i = 0; i < newSize; ++i) {
+ for (qsizetype i = 0; i < newSize; ++i) {
m_evaluateBlendClipAnimatorJobs[i]->setBlendClipAnimator(m_runningBlendedClipAnimators[i]);
Qt3DCore::QAspectJobPrivate::get(m_evaluateBlendClipAnimatorJobs[i].data())->clearDependencies();
if (hasLoadAnimationClipJob)
diff --git a/src/animation/backend/lerpclipblend.cpp b/src/animation/backend/lerpclipblend.cpp
index 4d03f70a3..fde8a3d28 100644
--- a/src/animation/backend/lerpclipblend.cpp
+++ b/src/animation/backend/lerpclipblend.cpp
@@ -39,10 +39,10 @@ ClipResults LerpClipBlend::doBlend(const QList<ClipResults> &blendData) const
{
Q_ASSERT(blendData.size() == 2);
Q_ASSERT(blendData[0].size() == blendData[1].size());
- const int elementCount = blendData.first().size();
+ const qsizetype elementCount = blendData.first().size();
ClipResults blendResults(elementCount);
- for (int i = 0; i < elementCount; ++i)
+ for (qsizetype i = 0; i < elementCount; ++i)
blendResults[i] = (1.0f - m_blendFactor) * blendData[0][i] + (m_blendFactor * blendData[1][i]);
return blendResults;
diff --git a/src/core/aspects/aspectcommanddebugger_p.h b/src/core/aspects/aspectcommanddebugger_p.h
index f950a7b46..5d10467a8 100644
--- a/src/core/aspects/aspectcommanddebugger_p.h
+++ b/src/core/aspects/aspectcommanddebugger_p.h
@@ -40,10 +40,10 @@ public:
struct Q_3DCORE_PRIVATE_EXPORT ReadBuffer {
QByteArray buffer;
- int startIdx = 0;
- int endIdx = 0;
+ qsizetype startIdx = 0;
+ qsizetype endIdx = 0;
- inline int size() const { return endIdx - startIdx; }
+ inline qsizetype size() const { return endIdx - startIdx; }
void insert(const QByteArray &array);
void trim();
};
diff --git a/src/core/geometry/qbuffer_p.h b/src/core/geometry/qbuffer_p.h
index 6ef08f5c9..161e83cd8 100644
--- a/src/core/geometry/qbuffer_p.h
+++ b/src/core/geometry/qbuffer_p.h
@@ -47,7 +47,7 @@ public:
struct QBufferUpdate
{
- int offset;
+ qsizetype offset;
QByteArray data;
};
diff --git a/src/core/services/qsysteminformationservice.cpp b/src/core/services/qsysteminformationservice.cpp
index 3ae5f76a6..70d6ded84 100644
--- a/src/core/services/qsysteminformationservice.cpp
+++ b/src/core/services/qsysteminformationservice.cpp
@@ -153,7 +153,7 @@ void QSystemInformationServicePrivate::writeFrameJobLogStats()
// Write submission thread
{
QMutexLocker lock(&m_localStoragesMutex);
- const int submissionJobSize = m_submissionStorage != nullptr ? m_submissionStorage->size() : 0;
+ const qsizetype submissionJobSize = m_submissionStorage != nullptr ? m_submissionStorage->size() : 0;
if (submissionJobSize > 0) {
FrameHeader header;
header.frameId = m_frameId;
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;
diff --git a/src/plugins/geometryloaders/default/objgeometryloader.cpp b/src/plugins/geometryloaders/default/objgeometryloader.cpp
index 264c951c3..dc41ca492 100644
--- a/src/plugins/geometryloaders/default/objgeometryloader.cpp
+++ b/src/plugins/geometryloaders/default/objgeometryloader.cpp
@@ -175,7 +175,7 @@ bool ObjGeometryLoader::doLoad(QIODevice *ioDev, const QString &subMesh)
// Iterate over the faceIndexMap and pull out pos, texCoord and normal data
// thereby generating unique vertices of data (by OpenGL definition)
- const int vertexCount = faceIndexMap.size();
+ const qsizetype vertexCount = faceIndexMap.size();
const bool hasTexCoords = !texCoords.isEmpty();
const bool hasNormals = !normals.isEmpty();
@@ -200,7 +200,7 @@ bool ObjGeometryLoader::doLoad(QIODevice *ioDev, const QString &subMesh)
}
// Now iterate over the face indices and lookup the unique vertex index
- const int indexCount = faceIndexVector.size();
+ const qsizetype indexCount = faceIndexVector.size();
m_indices.clear();
m_indices.reserve(indexCount);
for (const FaceIndices &faceIndices : std::as_const(faceIndexVector)) {
diff --git a/src/plugins/renderers/opengl/graphicshelpers/submissioncontext.cpp b/src/plugins/renderers/opengl/graphicshelpers/submissioncontext.cpp
index 326f7b780..e2cee1fcd 100644
--- a/src/plugins/renderers/opengl/graphicshelpers/submissioncontext.cpp
+++ b/src/plugins/renderers/opengl/graphicshelpers/submissioncontext.cpp
@@ -1497,7 +1497,7 @@ void SubmissionContext::uploadDataToGLBuffer(Buffer *buffer, GLBuffer *b, bool r
// We have a partial update
if (update->offset >= 0) {
//accumulate sequential updates as single one
- int bufferSize = update->data.size();
+ qsizetype bufferSize = update->data.size();
auto it2 = it + 1;
while ((it2 != updates.end())
&& (it2->offset - update->offset == bufferSize)) {
@@ -1517,7 +1517,7 @@ void SubmissionContext::uploadDataToGLBuffer(Buffer *buffer, GLBuffer *b, bool r
// We have an update that was done by calling QBuffer::setData
// which is used to resize or entirely clear the buffer
// Note: we use the buffer data directly in that case
- const int bufferSize = buffer->data().size();
+ const qsizetype bufferSize = buffer->data().size();
b->allocate(this, bufferSize, false); // orphan the buffer
b->allocate(this, buffer->data().constData(), bufferSize, false);
}
diff --git a/src/plugins/renderers/opengl/renderer/frameprofiler_p.h b/src/plugins/renderers/opengl/renderer/frameprofiler_p.h
index 066a0be46..11da771fb 100644
--- a/src/plugins/renderers/opengl/renderer/frameprofiler_p.h
+++ b/src/plugins/renderers/opengl/renderer/frameprofiler_p.h
@@ -121,8 +121,8 @@ public:
Qt3DCore::QSystemInformationServicePrivate *dservice = Qt3DCore::QSystemInformationServicePrivate::get(m_service);
- int j = 0;
- for (int i = 0, m = m_recordings.size(); i < m; ++i) {
+ qsizetype j = 0;
+ for (qsizetype i = 0, m = m_recordings.size(); i < m; ++i) {
const GLRecording rec = m_recordings.at(i);
Qt3DCore::QSystemInformationServicePrivate::JobRunStats glRecordingStat;
diff --git a/src/plugins/renderers/rhi/graphicshelpers/submissioncontext.cpp b/src/plugins/renderers/rhi/graphicshelpers/submissioncontext.cpp
index 0d3ef1e1b..68310b00e 100644
--- a/src/plugins/renderers/rhi/graphicshelpers/submissioncontext.cpp
+++ b/src/plugins/renderers/rhi/graphicshelpers/submissioncontext.cpp
@@ -1279,7 +1279,7 @@ void SubmissionContext::uploadDataToRHIBuffer(Buffer *buffer, RHIBuffer *b)
// We have a partial update
if (update->offset >= 0) {
// accumulate sequential updates as single one
- int bufferSize = update->data.size();
+ qsizetype bufferSize = update->data.size();
auto it2 = it + 1;
while ((it2 != updates.end()) && (it2->offset - update->offset == bufferSize)) {
bufferSize += it2->data.size();
@@ -1361,7 +1361,7 @@ void preprocessRHIShader(std::vector<QByteArray> &shaderCodes)
"\\s*,\\s*std140.*)\\)\\s*uniform\\s*([a-zA-Z0-9_]+)"));
auto replaceBinding = [&bindings, &assignedBindings](
- int &offset, QRegularExpressionMatch &match, QString &code,
+ qsizetype &offset, QRegularExpressionMatch &match, QString &code,
int indexCapture, int variableCapture) noexcept {
int index = match.captured(indexCapture).toInt();
QByteArray variable = match.captured(variableCapture).toUtf8();
@@ -1375,9 +1375,9 @@ void preprocessRHIShader(std::vector<QByteArray> &shaderCodes)
return;
}
- const int indexStartOffset = match.capturedStart(indexCapture);
- const int indexEndOffset = match.capturedEnd(indexCapture);
- const int indexLength = indexEndOffset - indexStartOffset;
+ const qsizetype indexStartOffset = match.capturedStart(indexCapture);
+ const qsizetype indexEndOffset = match.capturedEnd(indexCapture);
+ const qsizetype indexLength = indexEndOffset - indexStartOffset;
code.replace(indexStartOffset, indexLength, QByteArray::number(index));
}
@@ -1385,9 +1385,9 @@ void preprocessRHIShader(std::vector<QByteArray> &shaderCodes)
bindings.emplace(std::move(variable), index);
} else {
int indexToUse = it->second;
- const int indexStartOffset = match.capturedStart(indexCapture);
- const int indexEndOffset = match.capturedEnd(indexCapture);
- const int indexLength = indexEndOffset - indexStartOffset;
+ const qsizetype indexStartOffset = match.capturedStart(indexCapture);
+ const qsizetype indexEndOffset = match.capturedEnd(indexCapture);
+ const qsizetype indexLength = indexEndOffset - indexStartOffset;
code.replace(indexStartOffset, indexLength, QByteArray::number(indexToUse));
}
// This may fail in the case where the replaced offset is an incredibly long number,
@@ -1400,7 +1400,7 @@ void preprocessRHIShader(std::vector<QByteArray> &shaderCodes)
QString shaderString = shaderCode;
// Regex for the sampler variables
- int offset = 0;
+ qsizetype offset = 0;
auto match = samplerRegex.match(shaderString, offset);
while (match.hasMatch()) {
const int indexCapture = 1;
diff --git a/src/plugins/renderers/rhi/renderer/rhishader.cpp b/src/plugins/renderers/rhi/renderer/rhishader.cpp
index 1e6b97292..5a308fa37 100644
--- a/src/plugins/renderers/rhi/renderer/rhishader.cpp
+++ b/src/plugins/renderers/rhi/renderer/rhishader.cpp
@@ -350,7 +350,7 @@ bool isGeneratedUBOName(const QByteArray& arr)
return false;
if (!arr.startsWith('_'))
return false;
- for (int i = 1, N = arr.size(); i < N; i++) {
+ for (qsizetype i = 1, N = arr.size(); i < N; i++) {
if (arr[i] < '0' || arr[i] > '9')
return false;
}
diff --git a/src/render/geometry/skeleton_p.h b/src/render/geometry/skeleton_p.h
index 48f405a3e..453db60f9 100644
--- a/src/render/geometry/skeleton_p.h
+++ b/src/render/geometry/skeleton_p.h
@@ -68,7 +68,7 @@ public:
void setName(const QString &name) { m_name = name; }
QString name() const { return m_name; }
- int jointCount() const { return m_skeletonData.joints.size(); }
+ qsizetype jointCount() const { return m_skeletonData.joints.size(); }
QVector<JointInfo> joints() const { return m_skeletonData.joints; }
QVector<QString> jointNames() const { return m_skeletonData.jointNames; }
QVector<Qt3DCore::Sqt> localPoses() const { return m_skeletonData.localPoses; }
diff --git a/src/render/jobs/filterlayerentityjob.cpp b/src/render/jobs/filterlayerentityjob.cpp
index fd13a4c50..07d869bba 100644
--- a/src/render/jobs/filterlayerentityjob.cpp
+++ b/src/render/jobs/filterlayerentityjob.cpp
@@ -163,7 +163,7 @@ void FilterLayerEntityJob::filterLayerAndEntity()
Qt3DCore::QNodeIdVector layerIds = layerFilter->layerIds();
// Remove layerIds which are not active/enabled
- for (int i = layerIds.size() - 1; i >= 0; --i) {
+ for (qsizetype i = layerIds.size() - 1; i >= 0; --i) {
Layer *backendLayer = layerManager->lookupResource(layerIds.at(i));
if (backendLayer == nullptr || !backendLayer->isEnabled())
layerIds.removeAt(i);
diff --git a/src/render/jobs/loadskeletonjob.cpp b/src/render/jobs/loadskeletonjob.cpp
index d83032e6a..10603a3db 100644
--- a/src/render/jobs/loadskeletonjob.cpp
+++ b/src/render/jobs/loadskeletonjob.cpp
@@ -176,9 +176,9 @@ Qt3DCore::QJoint *LoadSkeletonJob::createFrontendJoints(const SkeletonData &skel
// Create frontend joints from the joint info objects
QList<Qt3DCore::QJoint *> frontendJoints;
- const int jointCount = skeletonData.joints.size();
+ const qsizetype jointCount = skeletonData.joints.size();
frontendJoints.reserve(jointCount);
- for (int i = 0; i < jointCount; ++i) {
+ for (qsizetype i = 0; i < jointCount; ++i) {
const QMatrix4x4 &inverseBindMatrix = skeletonData.joints[i].inverseBindPose;
const QString &jointName = skeletonData.jointNames[i];
const Qt3DCore::Sqt &localPose = skeletonData.localPoses[i];
@@ -186,7 +186,7 @@ Qt3DCore::QJoint *LoadSkeletonJob::createFrontendJoints(const SkeletonData &skel
}
// Now go through and resolve the parent for each joint
- for (int i = 0; i < frontendJoints.size(); ++i) {
+ for (qsizetype i = 0; i < frontendJoints.size(); ++i) {
const auto parentIndex = skeletonData.joints[i].parentIndex;
if (parentIndex == -1)
continue;
@@ -226,7 +226,7 @@ void LoadSkeletonJob::processJointHierarchy(Qt3DCore::QNodeId jointId,
skeletonData.localPoses.push_back(joint->localPose());
skeletonData.jointNames.push_back(joint->name());
- const int jointIndex = skeletonData.joints.size() - 1;
+ const qsizetype jointIndex = skeletonData.joints.size() - 1;
const HJoint jointHandle = m_nodeManagers->jointManager()->lookupHandle(jointId);
skeletonData.jointIndices.insert(jointHandle, jointIndex);
diff --git a/src/render/jobs/updatelevelofdetailjob.cpp b/src/render/jobs/updatelevelofdetailjob.cpp
index c7ca231a4..ee4de1245 100644
--- a/src/render/jobs/updatelevelofdetailjob.cpp
+++ b/src/render/jobs/updatelevelofdetailjob.cpp
@@ -91,8 +91,8 @@ private:
const Vector3D tcenter = viewMatrix.map(center);
const double dist = double(tcenter.length());
- const int n = thresholds.size();
- for (int i=0; i<n; ++i) {
+ const qsizetype n = thresholds.size();
+ for (qsizetype i = 0; i < n; ++i) {
if (dist <= thresholds[i] || i == n -1) {
m_filterValue = approxRollingAverage<30>(m_filterValue, i);
i = qBound(0, static_cast<int>(qRound(m_filterValue)), n - 1);
@@ -137,8 +137,8 @@ private:
const QRect r = windowViewport(vca.area, vca.viewport);
area = std::sqrt(area * float(r.width()) * float(r.height()));
- const int n = thresholds.size();
- for (int i = 0; i < n; ++i) {
+ const qsizetype n = thresholds.size();
+ for (qsizetype i = 0; i < n; ++i) {
if (thresholds[i] < area || i == n -1) {
m_filterValue = approxRollingAverage<30>(m_filterValue, i);
i = qBound(0, static_cast<int>(qRound(m_filterValue)), n - 1);
diff --git a/src/render/materialsystem/qshaderprogram.cpp b/src/render/materialsystem/qshaderprogram.cpp
index 33f6be6a2..cbb1b77b5 100644
--- a/src/render/materialsystem/qshaderprogram.cpp
+++ b/src/render/materialsystem/qshaderprogram.cpp
@@ -835,9 +835,9 @@ QByteArray QShaderProgramPrivate::resolveAutoBindingIndices(const QByteArray &co
// This lambda will replace all occurrences of a string (e.g. "binding = auto") by another,
// with the incremented int passed as argument (e.g. "binding = 1", "binding = 2" ...)
const auto replaceAndIncrement = [&](const QRegularExpression &regexp,
- int &variable,
- const QString &replacement) noexcept {
- int matchStart = 0;
+ int &variable,
+ const QString &replacement) noexcept {
+ qsizetype matchStart = 0;
do {
matchStart = shaderCode.indexOf(regexp, matchStart);
if (matchStart != -1) {
diff --git a/src/render/shadergraph/qshadergenerator.cpp b/src/render/shadergraph/qshadergenerator.cpp
index 05e578c78..96e80312a 100644
--- a/src/render/shadergraph/qshadergenerator.cpp
+++ b/src/render/shadergraph/qshadergenerator.cpp
@@ -611,17 +611,17 @@ QByteArray QShaderGenerator::createShaderCode(const QStringList &enabledLayers)
variableReplacements.append(std::move(replacement));
}
- int begin = 0;
+ qsizetype begin = 0;
while ((begin = line.indexOf('$', begin)) != -1) {
- int end = begin + 1;
+ qsizetype end = begin + 1;
char endChar = line.at(end);
- const int size = line.size();
+ const qsizetype size = line.size();
while (end < size && (std::isalnum(endChar) || endChar == '_')) {
++end;
endChar = line.at(end);
}
- const int placeholderLength = end - begin;
+ const qsizetype placeholderLength = end - begin;
const QByteArray variableName = line.mid(begin, placeholderLength);
const auto replacementIt =