From a6f854745583fbb9a0ed7e296ffaeaaec8681fd7 Mon Sep 17 00:00:00 2001 From: Dan Paulat Date: Thu, 10 Jul 2025 23:27:24 -0500 Subject: [PATCH] Fix GLEW clang-tidy issues --- scwx-qt/source/scwx/qt/gl/draw/draw_item.cpp | 4 +-- scwx-qt/source/scwx/qt/gl/draw/geo_icons.cpp | 35 ++++++++++++------- scwx-qt/source/scwx/qt/gl/draw/geo_lines.cpp | 26 +++++++++----- scwx-qt/source/scwx/qt/gl/draw/icons.cpp | 26 +++++++++----- .../source/scwx/qt/gl/draw/linked_vectors.cpp | 4 +-- .../scwx/qt/gl/draw/placefile_icons.cpp | 35 ++++++++++++------- .../scwx/qt/gl/draw/placefile_images.cpp | 35 ++++++++++++------- .../scwx/qt/gl/draw/placefile_lines.cpp | 26 +++++++++----- .../scwx/qt/gl/draw/placefile_polygons.cpp | 26 +++++++++----- .../source/scwx/qt/gl/draw/placefile_text.cpp | 12 +++---- .../source/scwx/qt/gl/draw/placefile_text.hpp | 3 +- .../scwx/qt/gl/draw/placefile_triangles.cpp | 26 +++++++++----- scwx-qt/source/scwx/qt/gl/draw/rectangle.cpp | 8 ++++- scwx-qt/source/scwx/qt/gl/gl_context.cpp | 2 +- .../source/scwx/qt/map/placefile_layer.cpp | 3 +- 15 files changed, 176 insertions(+), 95 deletions(-) diff --git a/scwx-qt/source/scwx/qt/gl/draw/draw_item.cpp b/scwx-qt/source/scwx/qt/gl/draw/draw_item.cpp index 6002d2ce..0f18e40f 100644 --- a/scwx-qt/source/scwx/qt/gl/draw/draw_item.cpp +++ b/scwx-qt/source/scwx/qt/gl/draw/draw_item.cpp @@ -30,8 +30,8 @@ static const std::string logPrefix_ = "scwx::qt::gl::draw::draw_item"; class DrawItem::Impl { public: - explicit Impl() {} - ~Impl() {} + explicit Impl() = default; + ~Impl() = default; }; DrawItem::DrawItem() : p(std::make_unique()) {} diff --git a/scwx-qt/source/scwx/qt/gl/draw/geo_icons.cpp b/scwx-qt/source/scwx/qt/gl/draw/geo_icons.cpp index 5c1555ac..ba3162e9 100644 --- a/scwx-qt/source/scwx/qt/gl/draw/geo_icons.cpp +++ b/scwx-qt/source/scwx/qt/gl/draw/geo_icons.cpp @@ -186,6 +186,10 @@ void GeoIcons::Initialize() glBindBuffer(GL_ARRAY_BUFFER, p->vbo_[0]); glBufferData(GL_ARRAY_BUFFER, 0u, nullptr, GL_DYNAMIC_DRAW); + // NOLINTBEGIN(modernize-use-nullptr) + // NOLINTBEGIN(performance-no-int-to-ptr) + // NOLINTBEGIN(cppcoreguidelines-avoid-magic-numbers) + // aLatLong glVertexAttribPointer(0, 2, @@ -261,6 +265,10 @@ void GeoIcons::Initialize() reinterpret_cast(3 * sizeof(GLint))); glEnableVertexAttribArray(7); + // NOLINTEND(cppcoreguidelines-avoid-magic-numbers) + // NOLINTEND(performance-no-int-to-ptr) + // NOLINTEND(modernize-use-nullptr) + p->dirty_ = true; } @@ -857,10 +865,11 @@ void GeoIcons::Impl::Update(bool textureAtlasChanged) // Buffer texture data glBindBuffer(GL_ARRAY_BUFFER, vbo_[1]); - glBufferData(GL_ARRAY_BUFFER, - sizeof(float) * textureBuffer_.size(), - textureBuffer_.data(), - GL_DYNAMIC_DRAW); + glBufferData( + GL_ARRAY_BUFFER, + static_cast(sizeof(float) * textureBuffer_.size()), + textureBuffer_.data(), + GL_DYNAMIC_DRAW); lastTextureAtlasChanged_ = false; } @@ -870,17 +879,19 @@ void GeoIcons::Impl::Update(bool textureAtlasChanged) { // Buffer vertex data glBindBuffer(GL_ARRAY_BUFFER, vbo_[0]); - glBufferData(GL_ARRAY_BUFFER, - sizeof(float) * currentIconBuffer_.size(), - currentIconBuffer_.data(), - GL_DYNAMIC_DRAW); + glBufferData( + GL_ARRAY_BUFFER, + static_cast(sizeof(float) * currentIconBuffer_.size()), + currentIconBuffer_.data(), + GL_DYNAMIC_DRAW); // Buffer threshold data glBindBuffer(GL_ARRAY_BUFFER, vbo_[2]); - glBufferData(GL_ARRAY_BUFFER, - sizeof(GLint) * currentIntegerBuffer_.size(), - currentIntegerBuffer_.data(), - GL_DYNAMIC_DRAW); + glBufferData( + GL_ARRAY_BUFFER, + static_cast(sizeof(GLint) * currentIntegerBuffer_.size()), + currentIntegerBuffer_.data(), + GL_DYNAMIC_DRAW); numVertices_ = static_cast(currentIconBuffer_.size() / kPointsPerVertex); diff --git a/scwx-qt/source/scwx/qt/gl/draw/geo_lines.cpp b/scwx-qt/source/scwx/qt/gl/draw/geo_lines.cpp index 80bd6b2e..aa376b00 100644 --- a/scwx-qt/source/scwx/qt/gl/draw/geo_lines.cpp +++ b/scwx-qt/source/scwx/qt/gl/draw/geo_lines.cpp @@ -175,6 +175,10 @@ void GeoLines::Initialize() nullptr, GL_DYNAMIC_DRAW); + // NOLINTBEGIN(modernize-use-nullptr) + // NOLINTBEGIN(performance-no-int-to-ptr) + // NOLINTBEGIN(cppcoreguidelines-avoid-magic-numbers) + // aLatLong glVertexAttribPointer(0, 2, @@ -238,6 +242,10 @@ void GeoLines::Initialize() reinterpret_cast(3 * sizeof(GLint))); glEnableVertexAttribArray(7); + // NOLINTEND(cppcoreguidelines-avoid-magic-numbers) + // NOLINTEND(performance-no-int-to-ptr) + // NOLINTEND(modernize-use-nullptr) + p->dirty_ = true; } @@ -667,17 +675,19 @@ void GeoLines::Impl::Update() { // Buffer lines data glBindBuffer(GL_ARRAY_BUFFER, vbo_[0]); - glBufferData(GL_ARRAY_BUFFER, - sizeof(float) * currentLinesBuffer_.size(), - currentLinesBuffer_.data(), - GL_DYNAMIC_DRAW); + glBufferData( + GL_ARRAY_BUFFER, + static_cast(sizeof(float) * currentLinesBuffer_.size()), + currentLinesBuffer_.data(), + GL_DYNAMIC_DRAW); // Buffer threshold data glBindBuffer(GL_ARRAY_BUFFER, vbo_[1]); - glBufferData(GL_ARRAY_BUFFER, - sizeof(GLint) * currentIntegerBuffer_.size(), - currentIntegerBuffer_.data(), - GL_DYNAMIC_DRAW); + glBufferData( + GL_ARRAY_BUFFER, + static_cast(sizeof(GLint) * currentIntegerBuffer_.size()), + currentIntegerBuffer_.data(), + GL_DYNAMIC_DRAW); } dirty_ = false; diff --git a/scwx-qt/source/scwx/qt/gl/draw/icons.cpp b/scwx-qt/source/scwx/qt/gl/draw/icons.cpp index ffbb7e2e..b72f4443 100644 --- a/scwx-qt/source/scwx/qt/gl/draw/icons.cpp +++ b/scwx-qt/source/scwx/qt/gl/draw/icons.cpp @@ -140,6 +140,10 @@ void Icons::Initialize() glBindBuffer(GL_ARRAY_BUFFER, p->vbo_[0]); glBufferData(GL_ARRAY_BUFFER, 0u, nullptr, GL_DYNAMIC_DRAW); + // NOLINTBEGIN(modernize-use-nullptr) + // NOLINTBEGIN(performance-no-int-to-ptr) + // NOLINTBEGIN(cppcoreguidelines-avoid-magic-numbers) + // aVertex glVertexAttribPointer(0, 2, @@ -197,6 +201,10 @@ void Icons::Initialize() static_cast(0)); glEnableVertexAttribArray(2); + // NOLINTEND(cppcoreguidelines-avoid-magic-numbers) + // NOLINTEND(performance-no-int-to-ptr) + // NOLINTEND(modernize-use-nullptr) + p->dirty_ = true; } @@ -689,10 +697,11 @@ void Icons::Impl::Update(bool textureAtlasChanged) // Buffer texture data glBindBuffer(GL_ARRAY_BUFFER, vbo_[1]); - glBufferData(GL_ARRAY_BUFFER, - sizeof(float) * textureBuffer_.size(), - textureBuffer_.data(), - GL_DYNAMIC_DRAW); + glBufferData( + GL_ARRAY_BUFFER, + static_cast(sizeof(float) * textureBuffer_.size()), + textureBuffer_.data(), + GL_DYNAMIC_DRAW); lastTextureAtlasChanged_ = false; } @@ -702,10 +711,11 @@ void Icons::Impl::Update(bool textureAtlasChanged) { // Buffer vertex data glBindBuffer(GL_ARRAY_BUFFER, vbo_[0]); - glBufferData(GL_ARRAY_BUFFER, - sizeof(float) * currentIconBuffer_.size(), - currentIconBuffer_.data(), - GL_DYNAMIC_DRAW); + glBufferData( + GL_ARRAY_BUFFER, + static_cast(sizeof(float) * currentIconBuffer_.size()), + currentIconBuffer_.data(), + GL_DYNAMIC_DRAW); numVertices_ = static_cast(currentIconBuffer_.size() / kPointsPerVertex); diff --git a/scwx-qt/source/scwx/qt/gl/draw/linked_vectors.cpp b/scwx-qt/source/scwx/qt/gl/draw/linked_vectors.cpp index bc83ffe1..dfc3dd07 100644 --- a/scwx-qt/source/scwx/qt/gl/draw/linked_vectors.cpp +++ b/scwx-qt/source/scwx/qt/gl/draw/linked_vectors.cpp @@ -63,14 +63,12 @@ class LinkedVectors::Impl { public: explicit Impl(std::shared_ptr context) : - context_ {context}, geoLines_ {std::make_shared(context)} + geoLines_ {std::make_shared(context)} { } ~Impl() {} - std::shared_ptr context_; - bool borderEnabled_ {true}; bool visible_ {true}; diff --git a/scwx-qt/source/scwx/qt/gl/draw/placefile_icons.cpp b/scwx-qt/source/scwx/qt/gl/draw/placefile_icons.cpp index 6de20db0..9ce7dc8f 100644 --- a/scwx-qt/source/scwx/qt/gl/draw/placefile_icons.cpp +++ b/scwx-qt/source/scwx/qt/gl/draw/placefile_icons.cpp @@ -182,6 +182,10 @@ void PlacefileIcons::Initialize() glBindBuffer(GL_ARRAY_BUFFER, p->vbo_[0]); glBufferData(GL_ARRAY_BUFFER, 0u, nullptr, GL_DYNAMIC_DRAW); + // NOLINTBEGIN(modernize-use-nullptr) + // NOLINTBEGIN(performance-no-int-to-ptr) + // NOLINTBEGIN(cppcoreguidelines-avoid-magic-numbers) + // aLatLong glVertexAttribPointer(0, 2, @@ -252,6 +256,10 @@ void PlacefileIcons::Initialize() // aDisplayed glVertexAttribI1i(7, 1); + // NOLINTEND(cppcoreguidelines-avoid-magic-numbers) + // NOLINTEND(performance-no-int-to-ptr) + // NOLINTEND(modernize-use-nullptr) + p->dirty_ = true; } @@ -649,10 +657,11 @@ void PlacefileIcons::Impl::Update(bool textureAtlasChanged) // Buffer texture data glBindBuffer(GL_ARRAY_BUFFER, vbo_[1]); - glBufferData(GL_ARRAY_BUFFER, - sizeof(float) * textureBuffer_.size(), - textureBuffer_.data(), - GL_DYNAMIC_DRAW); + glBufferData( + GL_ARRAY_BUFFER, + static_cast(sizeof(float) * textureBuffer_.size()), + textureBuffer_.data(), + GL_DYNAMIC_DRAW); } // If buffers need updating @@ -660,17 +669,19 @@ void PlacefileIcons::Impl::Update(bool textureAtlasChanged) { // Buffer vertex data glBindBuffer(GL_ARRAY_BUFFER, vbo_[0]); - glBufferData(GL_ARRAY_BUFFER, - sizeof(float) * currentIconBuffer_.size(), - currentIconBuffer_.data(), - GL_DYNAMIC_DRAW); + glBufferData( + GL_ARRAY_BUFFER, + static_cast(sizeof(float) * currentIconBuffer_.size()), + currentIconBuffer_.data(), + GL_DYNAMIC_DRAW); // Buffer threshold data glBindBuffer(GL_ARRAY_BUFFER, vbo_[2]); - glBufferData(GL_ARRAY_BUFFER, - sizeof(GLint) * currentIntegerBuffer_.size(), - currentIntegerBuffer_.data(), - GL_DYNAMIC_DRAW); + glBufferData( + GL_ARRAY_BUFFER, + static_cast(sizeof(GLint) * currentIntegerBuffer_.size()), + currentIntegerBuffer_.data(), + GL_DYNAMIC_DRAW); numVertices_ = static_cast(currentIconBuffer_.size() / kPointsPerVertex); diff --git a/scwx-qt/source/scwx/qt/gl/draw/placefile_images.cpp b/scwx-qt/source/scwx/qt/gl/draw/placefile_images.cpp index c8dbc194..16d4d19b 100644 --- a/scwx-qt/source/scwx/qt/gl/draw/placefile_images.cpp +++ b/scwx-qt/source/scwx/qt/gl/draw/placefile_images.cpp @@ -160,6 +160,10 @@ void PlacefileImages::Initialize() glBindBuffer(GL_ARRAY_BUFFER, p->vbo_[0]); glBufferData(GL_ARRAY_BUFFER, 0u, nullptr, GL_DYNAMIC_DRAW); + // NOLINTBEGIN(modernize-use-nullptr) + // NOLINTBEGIN(performance-no-int-to-ptr) + // NOLINTBEGIN(cppcoreguidelines-avoid-magic-numbers) + // aLatLong glVertexAttribPointer(0, 2, @@ -221,6 +225,10 @@ void PlacefileImages::Initialize() // aDisplayed glVertexAttribI1i(7, 1); + // NOLINTEND(cppcoreguidelines-avoid-magic-numbers) + // NOLINTEND(performance-no-int-to-ptr) + // NOLINTEND(modernize-use-nullptr) + p->dirty_ = true; } @@ -446,10 +454,11 @@ void PlacefileImages::Impl::Update(bool textureAtlasChanged) // Buffer texture data glBindBuffer(GL_ARRAY_BUFFER, vbo_[1]); - glBufferData(GL_ARRAY_BUFFER, - sizeof(float) * textureBuffer_.size(), - textureBuffer_.data(), - GL_DYNAMIC_DRAW); + glBufferData( + GL_ARRAY_BUFFER, + static_cast(sizeof(float) * textureBuffer_.size()), + textureBuffer_.data(), + GL_DYNAMIC_DRAW); } // If buffers need updating @@ -457,17 +466,19 @@ void PlacefileImages::Impl::Update(bool textureAtlasChanged) { // Buffer vertex data glBindBuffer(GL_ARRAY_BUFFER, vbo_[0]); - glBufferData(GL_ARRAY_BUFFER, - sizeof(float) * currentImageBuffer_.size(), - currentImageBuffer_.data(), - GL_DYNAMIC_DRAW); + glBufferData( + GL_ARRAY_BUFFER, + static_cast(sizeof(float) * currentImageBuffer_.size()), + currentImageBuffer_.data(), + GL_DYNAMIC_DRAW); // Buffer threshold data glBindBuffer(GL_ARRAY_BUFFER, vbo_[2]); - glBufferData(GL_ARRAY_BUFFER, - sizeof(GLint) * currentIntegerBuffer_.size(), - currentIntegerBuffer_.data(), - GL_DYNAMIC_DRAW); + glBufferData( + GL_ARRAY_BUFFER, + static_cast(sizeof(GLint) * currentIntegerBuffer_.size()), + currentIntegerBuffer_.data(), + GL_DYNAMIC_DRAW); numVertices_ = static_cast(currentImageBuffer_.size() / kPointsPerVertex); diff --git a/scwx-qt/source/scwx/qt/gl/draw/placefile_lines.cpp b/scwx-qt/source/scwx/qt/gl/draw/placefile_lines.cpp index 44b81407..134d9c6b 100644 --- a/scwx-qt/source/scwx/qt/gl/draw/placefile_lines.cpp +++ b/scwx-qt/source/scwx/qt/gl/draw/placefile_lines.cpp @@ -148,6 +148,10 @@ void PlacefileLines::Initialize() glBindBuffer(GL_ARRAY_BUFFER, p->vbo_[0]); glBufferData(GL_ARRAY_BUFFER, 0u, nullptr, GL_DYNAMIC_DRAW); + // NOLINTBEGIN(modernize-use-nullptr) + // NOLINTBEGIN(performance-no-int-to-ptr) + // NOLINTBEGIN(cppcoreguidelines-avoid-magic-numbers) + // aLatLong glVertexAttribPointer(0, 2, @@ -206,6 +210,10 @@ void PlacefileLines::Initialize() // aDisplayed glVertexAttribI1i(7, 1); + // NOLINTEND(cppcoreguidelines-avoid-magic-numbers) + // NOLINTEND(performance-no-int-to-ptr) + // NOLINTEND(modernize-use-nullptr) + p->dirty_ = true; } @@ -470,17 +478,19 @@ void PlacefileLines::Impl::Update() { // Buffer lines data glBindBuffer(GL_ARRAY_BUFFER, vbo_[0]); - glBufferData(GL_ARRAY_BUFFER, - sizeof(float) * currentLinesBuffer_.size(), - currentLinesBuffer_.data(), - GL_DYNAMIC_DRAW); + glBufferData( + GL_ARRAY_BUFFER, + static_cast(sizeof(float) * currentLinesBuffer_.size()), + currentLinesBuffer_.data(), + GL_DYNAMIC_DRAW); // Buffer threshold data glBindBuffer(GL_ARRAY_BUFFER, vbo_[1]); - glBufferData(GL_ARRAY_BUFFER, - sizeof(GLint) * currentIntegerBuffer_.size(), - currentIntegerBuffer_.data(), - GL_DYNAMIC_DRAW); + glBufferData( + GL_ARRAY_BUFFER, + static_cast(sizeof(GLint) * currentIntegerBuffer_.size()), + currentIntegerBuffer_.data(), + GL_DYNAMIC_DRAW); } dirty_ = false; diff --git a/scwx-qt/source/scwx/qt/gl/draw/placefile_polygons.cpp b/scwx-qt/source/scwx/qt/gl/draw/placefile_polygons.cpp index e0f36c0b..646739ef 100644 --- a/scwx-qt/source/scwx/qt/gl/draw/placefile_polygons.cpp +++ b/scwx-qt/source/scwx/qt/gl/draw/placefile_polygons.cpp @@ -173,6 +173,10 @@ void PlacefilePolygons::Initialize() glBindBuffer(GL_ARRAY_BUFFER, p->vbo_[0]); glBufferData(GL_ARRAY_BUFFER, 0u, nullptr, GL_DYNAMIC_DRAW); + // NOLINTBEGIN(modernize-use-nullptr) + // NOLINTBEGIN(performance-no-int-to-ptr) + // NOLINTBEGIN(cppcoreguidelines-avoid-magic-numbers) + // aScreenCoord glVertexAttribPointer(0, 2, @@ -219,6 +223,10 @@ void PlacefilePolygons::Initialize() reinterpret_cast(1 * sizeof(GLint))); glEnableVertexAttribArray(4); + // NOLINTEND(cppcoreguidelines-avoid-magic-numbers) + // NOLINTEND(performance-no-int-to-ptr) + // NOLINTEND(modernize-use-nullptr) + p->dirty_ = true; } @@ -316,17 +324,19 @@ void PlacefilePolygons::Impl::Update() // Buffer vertex data glBindBuffer(GL_ARRAY_BUFFER, vbo_[0]); - glBufferData(GL_ARRAY_BUFFER, - sizeof(GLfloat) * currentBuffer_.size(), - currentBuffer_.data(), - GL_DYNAMIC_DRAW); + glBufferData( + GL_ARRAY_BUFFER, + static_cast(sizeof(GLfloat) * currentBuffer_.size()), + currentBuffer_.data(), + GL_DYNAMIC_DRAW); // Buffer threshold data glBindBuffer(GL_ARRAY_BUFFER, vbo_[1]); - glBufferData(GL_ARRAY_BUFFER, - sizeof(GLint) * currentIntegerBuffer_.size(), - currentIntegerBuffer_.data(), - GL_DYNAMIC_DRAW); + glBufferData( + GL_ARRAY_BUFFER, + static_cast(sizeof(GLint) * currentIntegerBuffer_.size()), + currentIntegerBuffer_.data(), + GL_DYNAMIC_DRAW); numVertices_ = static_cast(currentBuffer_.size() / kPointsPerVertex); diff --git a/scwx-qt/source/scwx/qt/gl/draw/placefile_text.cpp b/scwx-qt/source/scwx/qt/gl/draw/placefile_text.cpp index 337716d0..e133f98a 100644 --- a/scwx-qt/source/scwx/qt/gl/draw/placefile_text.cpp +++ b/scwx-qt/source/scwx/qt/gl/draw/placefile_text.cpp @@ -25,9 +25,8 @@ static const auto logger_ = scwx::util::Logger::Create(logPrefix_); class PlacefileText::Impl { public: - explicit Impl(const std::shared_ptr& context, - const std::string& placefileName) : - context_ {context}, placefileName_ {placefileName} + explicit Impl(const std::string& placefileName) : + placefileName_ {placefileName} { } @@ -43,8 +42,6 @@ public: float x, float y); - std::shared_ptr context_; - std::string placefileName_; bool thresholded_ {false}; @@ -70,9 +67,8 @@ public: std::vector> newFonts_ {}; }; -PlacefileText::PlacefileText(const std::shared_ptr& context, - const std::string& placefileName) : - DrawItem(), p(std::make_unique(context, placefileName)) +PlacefileText::PlacefileText(const std::string& placefileName) : + DrawItem(), p(std::make_unique(placefileName)) { } PlacefileText::~PlacefileText() = default; diff --git a/scwx-qt/source/scwx/qt/gl/draw/placefile_text.hpp b/scwx-qt/source/scwx/qt/gl/draw/placefile_text.hpp index 4cbaf0af..e36be5a6 100644 --- a/scwx-qt/source/scwx/qt/gl/draw/placefile_text.hpp +++ b/scwx-qt/source/scwx/qt/gl/draw/placefile_text.hpp @@ -19,8 +19,7 @@ namespace draw class PlacefileText : public DrawItem { public: - explicit PlacefileText(const std::shared_ptr& context, - const std::string& placefileName); + explicit PlacefileText(const std::string& placefileName); ~PlacefileText(); PlacefileText(const PlacefileText&) = delete; diff --git a/scwx-qt/source/scwx/qt/gl/draw/placefile_triangles.cpp b/scwx-qt/source/scwx/qt/gl/draw/placefile_triangles.cpp index 9d57150a..5ad54bc7 100644 --- a/scwx-qt/source/scwx/qt/gl/draw/placefile_triangles.cpp +++ b/scwx-qt/source/scwx/qt/gl/draw/placefile_triangles.cpp @@ -117,6 +117,10 @@ void PlacefileTriangles::Initialize() glBindBuffer(GL_ARRAY_BUFFER, p->vbo_[0]); glBufferData(GL_ARRAY_BUFFER, 0u, nullptr, GL_DYNAMIC_DRAW); + // NOLINTBEGIN(modernize-use-nullptr) + // NOLINTBEGIN(performance-no-int-to-ptr) + // NOLINTBEGIN(cppcoreguidelines-avoid-magic-numbers) + // aScreenCoord glVertexAttribPointer(0, 2, @@ -163,6 +167,10 @@ void PlacefileTriangles::Initialize() reinterpret_cast(1 * sizeof(GLint))); glEnableVertexAttribArray(4); + // NOLINTEND(cppcoreguidelines-avoid-magic-numbers) + // NOLINTEND(performance-no-int-to-ptr) + // NOLINTEND(modernize-use-nullptr) + p->dirty_ = true; } @@ -318,17 +326,19 @@ void PlacefileTriangles::Impl::Update() // Buffer vertex data glBindBuffer(GL_ARRAY_BUFFER, vbo_[0]); - glBufferData(GL_ARRAY_BUFFER, - sizeof(GLfloat) * currentBuffer_.size(), - currentBuffer_.data(), - GL_DYNAMIC_DRAW); + glBufferData( + GL_ARRAY_BUFFER, + static_cast(sizeof(GLfloat) * currentBuffer_.size()), + currentBuffer_.data(), + GL_DYNAMIC_DRAW); // Buffer threshold data glBindBuffer(GL_ARRAY_BUFFER, vbo_[1]); - glBufferData(GL_ARRAY_BUFFER, - sizeof(GLint) * currentIntegerBuffer_.size(), - currentIntegerBuffer_.data(), - GL_DYNAMIC_DRAW); + glBufferData( + GL_ARRAY_BUFFER, + static_cast(sizeof(GLint) * currentIntegerBuffer_.size()), + currentIntegerBuffer_.data(), + GL_DYNAMIC_DRAW); numVertices_ = static_cast(currentBuffer_.size() / kPointsPerVertex); diff --git a/scwx-qt/source/scwx/qt/gl/draw/rectangle.cpp b/scwx-qt/source/scwx/qt/gl/draw/rectangle.cpp index d6ec850a..616917a4 100644 --- a/scwx-qt/source/scwx/qt/gl/draw/rectangle.cpp +++ b/scwx-qt/source/scwx/qt/gl/draw/rectangle.cpp @@ -101,6 +101,8 @@ void Rectangle::Initialize() glBufferData( GL_ARRAY_BUFFER, sizeof(float) * BUFFER_LENGTH, nullptr, GL_DYNAMIC_DRAW); + // NOLINTBEGIN(performance-no-int-to-ptr) + glVertexAttribPointer(0, 3, GL_FLOAT, @@ -117,6 +119,8 @@ void Rectangle::Initialize() reinterpret_cast(3 * sizeof(float))); glEnableVertexAttribArray(1); + // NOLINTEND(performance-no-int-to-ptr) + p->dirty_ = true; } @@ -134,12 +138,14 @@ void Rectangle::Render(const QMapLibre::CustomLayerRenderParameters& params) if (p->fillColor_.has_value()) { // Draw fill + // NOLINTNEXTLINE(cppcoreguidelines-avoid-magic-numbers) glDrawArrays(GL_TRIANGLES, 24, 6); } if (p->borderWidth_ > 0.0f) { // Draw border + // NOLINTNEXTLINE(cppcoreguidelines-avoid-magic-numbers) glDrawArrays(GL_TRIANGLES, 0, 24); } } @@ -283,7 +289,7 @@ void Rectangle::Impl::Update() glBufferData(GL_ARRAY_BUFFER, sizeof(float) * BUFFER_LENGTH, - buffer, + static_cast(buffer), GL_DYNAMIC_DRAW); dirty_ = false; diff --git a/scwx-qt/source/scwx/qt/gl/gl_context.cpp b/scwx-qt/source/scwx/qt/gl/gl_context.cpp index 995a149a..11cfb4d9 100644 --- a/scwx-qt/source/scwx/qt/gl/gl_context.cpp +++ b/scwx-qt/source/scwx/qt/gl/gl_context.cpp @@ -60,7 +60,7 @@ void GlContext::Impl::InitializeGL() return; } - GLenum error = glewInit(); + const GLenum error = glewInit(); if (error != GLEW_OK) { logger_->error("glewInit failed: {}", diff --git a/scwx-qt/source/scwx/qt/map/placefile_layer.cpp b/scwx-qt/source/scwx/qt/map/placefile_layer.cpp index abafad8e..a5bcdc58 100644 --- a/scwx-qt/source/scwx/qt/map/placefile_layer.cpp +++ b/scwx-qt/source/scwx/qt/map/placefile_layer.cpp @@ -34,8 +34,7 @@ public: std::make_shared(glContext)}, placefileTriangles_ { std::make_shared(glContext)}, - placefileText_ { - std::make_shared(glContext, placefileName)} + placefileText_ {std::make_shared(placefileName)} { ConnectSignals(); }