summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThiago Marcos P. Santos <tmpsantos@gmail.com>2020-03-27 18:20:33 +0200
committerThiago Marcos P. Santos <tmpsantos@gmail.com>2020-03-30 23:37:44 +0300
commitb4e9c0bd119a154f45827d1a62ebaf8407758779 (patch)
tree96e7a2948f28740bd68ade0dbaa8354b75a5afa7
parent31338c5d88264422da7ac1d2e8672b3ef45b54b0 (diff)
downloadqtlocation-mapboxgl-b4e9c0bd119a154f45827d1a62ebaf8407758779.tar.gz
[core] Fix bugprone-too-small-loop-variable errors
As reported by clang-tidy-8.
-rw-r--r--platform/node/src/node_expression.cpp2
-rw-r--r--platform/node/src/node_feature.cpp2
-rw-r--r--platform/node/src/node_map.cpp2
-rw-r--r--src/mbgl/gl/vertex_array.cpp2
-rw-r--r--src/mbgl/renderer/buckets/fill_bucket.cpp4
-rw-r--r--src/mbgl/renderer/buckets/fill_extrusion_bucket.cpp4
-rw-r--r--src/mbgl/renderer/render_orchestrator.cpp2
7 files changed, 10 insertions, 8 deletions
diff --git a/platform/node/src/node_expression.cpp b/platform/node/src/node_expression.cpp
index f2feaf8ea4..b5e1b7d461 100644
--- a/platform/node/src/node_expression.cpp
+++ b/platform/node/src/node_expression.cpp
@@ -157,7 +157,7 @@ struct ToValue {
v8::Local<v8::Value> operator()(const std::vector<Value>& array) {
Nan::EscapableHandleScope scope;
v8::Local<v8::Array> result = Nan::New<v8::Array>();
- for (unsigned int i = 0; i < array.size(); i++) {
+ for (std::size_t i = 0; i < array.size(); i++) {
result->Set(i, toJS(array[i]));
}
return scope.Escape(result);
diff --git a/platform/node/src/node_feature.cpp b/platform/node/src/node_feature.cpp
index 646cc23338..594c732b14 100644
--- a/platform/node/src/node_feature.cpp
+++ b/platform/node/src/node_feature.cpp
@@ -112,7 +112,7 @@ struct ToValue {
v8::Local<v8::Value> operator()(const std::vector<mbgl::Value>& array) {
Nan::EscapableHandleScope scope;
v8::Local<v8::Array> result = Nan::New<v8::Array>();
- for (unsigned int i = 0; i < array.size(); i++) {
+ for (std::size_t i = 0; i < array.size(); i++) {
result->Set(i, toJS(array[i]));
}
return scope.Escape(result);
diff --git a/platform/node/src/node_map.cpp b/platform/node/src/node_map.cpp
index 550d3d594b..2be33150ec 100644
--- a/platform/node/src/node_map.cpp
+++ b/platform/node/src/node_map.cpp
@@ -1374,7 +1374,7 @@ void NodeMap::QueryRenderedFeatures(const Nan::FunctionCallbackInfo<v8::Value>&
}
auto array = Nan::New<v8::Array>();
- for (unsigned int i = 0; i < optional.size(); i++) {
+ for (std::size_t i = 0; i < optional.size(); i++) {
array->Set(i, toJS(optional[i]));
}
info.GetReturnValue().Set(array);
diff --git a/src/mbgl/gl/vertex_array.cpp b/src/mbgl/gl/vertex_array.cpp
index 831b118fce..e82e6e9765 100644
--- a/src/mbgl/gl/vertex_array.cpp
+++ b/src/mbgl/gl/vertex_array.cpp
@@ -12,6 +12,8 @@ void VertexArray::bind(Context& context,
state->indexBuffer = indexBuffer.getResource<gl::IndexBufferResource>().buffer;
state->bindings.reserve(bindings.size());
+
+ // NOLINTNEXTLINE(bugprone-too-small-loop-variable)
for (AttributeLocation location = 0; location < bindings.size(); ++location) {
if (state->bindings.size() <= location) {
state->bindings.emplace_back(context, AttributeLocation(location));
diff --git a/src/mbgl/renderer/buckets/fill_bucket.cpp b/src/mbgl/renderer/buckets/fill_bucket.cpp
index 4257d5ca6e..8a66486a58 100644
--- a/src/mbgl/renderer/buckets/fill_bucket.cpp
+++ b/src/mbgl/renderer/buckets/fill_bucket.cpp
@@ -80,7 +80,7 @@ void FillBucket::addFeature(const GeometryTileFeature& feature,
vertices.emplace_back(FillProgram::layoutVertex(ring[0]));
lines.emplace_back(lineIndex + nVertices - 1, lineIndex);
- for (uint32_t i = 1; i < nVertices; i++) {
+ for (std::size_t i = 1; i < nVertices; i++) {
vertices.emplace_back(FillProgram::layoutVertex(ring[i]));
lines.emplace_back(lineIndex + i - 1, lineIndex + i);
}
@@ -102,7 +102,7 @@ void FillBucket::addFeature(const GeometryTileFeature& feature,
assert(triangleSegment.vertexLength <= std::numeric_limits<uint16_t>::max());
uint16_t triangleIndex = triangleSegment.vertexLength;
- for (uint32_t i = 0; i < nIndicies; i += 3) {
+ for (std::size_t i = 0; i < nIndicies; i += 3) {
triangles.emplace_back(triangleIndex + indices[i],
triangleIndex + indices[i + 1],
triangleIndex + indices[i + 2]);
diff --git a/src/mbgl/renderer/buckets/fill_extrusion_bucket.cpp b/src/mbgl/renderer/buckets/fill_extrusion_bucket.cpp
index 39c9f9af1e..46724e31e6 100644
--- a/src/mbgl/renderer/buckets/fill_extrusion_bucket.cpp
+++ b/src/mbgl/renderer/buckets/fill_extrusion_bucket.cpp
@@ -96,7 +96,7 @@ void FillExtrusionBucket::addFeature(const GeometryTileFeature& feature,
std::size_t edgeDistance = 0;
- for (uint32_t i = 0; i < nVertices; i++) {
+ for (std::size_t i = 0; i < nVertices; i++) {
const auto& p1 = ring[i];
vertices.emplace_back(
@@ -147,7 +147,7 @@ void FillExtrusionBucket::addFeature(const GeometryTileFeature& feature,
std::size_t nIndices = indices.size();
assert(nIndices % 3 == 0);
- for (uint32_t i = 0; i < nIndices; i += 3) {
+ for (std::size_t i = 0; i < nIndices; i += 3) {
// Counter-Clockwise winding order.
triangles.emplace_back(flatIndices[indices[i]], flatIndices[indices[i + 2]],
flatIndices[indices[i + 1]]);
diff --git a/src/mbgl/renderer/render_orchestrator.cpp b/src/mbgl/renderer/render_orchestrator.cpp
index 8c8cd4a0ea..921b764e2d 100644
--- a/src/mbgl/renderer/render_orchestrator.cpp
+++ b/src/mbgl/renderer/render_orchestrator.cpp
@@ -305,7 +305,7 @@ std::unique_ptr<RenderTree> RenderOrchestrator::createRenderTree(
bool sourceNeedsRendering = false;
bool sourceNeedsRelayout = false;
- for (uint32_t index = 0u; index < orderedLayers.size(); ++index) {
+ for (std::size_t index = 0; index < orderedLayers.size(); ++index) {
RenderLayer& layer = orderedLayers[index];
const auto* layerInfo = layer.baseImpl->getTypeInfo();
const bool layerIsVisible = layer.baseImpl->visibility != style::VisibilityType::None;