Skip to content

Commit

Permalink
Don't leak App in unit tests as clang-tidy complains
Browse files Browse the repository at this point in the history
  • Loading branch information
jhasse committed Oct 27, 2024
1 parent 8967e20 commit 98d6e82
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/App.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ App::~App() {

App& App::instance() {
if (!self) {
self = new App;
static App dummy; // e.g. for unit tests
self = &dummy;
}
return *self;
}
Expand Down
6 changes: 3 additions & 3 deletions src/jngl/Mat3.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2021-2023 Jan Niklas Hasse <jhasse@bixense.com>
// Copyright 2021-2024 Jan Niklas Hasse <jhasse@bixense.com>
// For conditions of distribution and use, see copyright notice in LICENSE.txt
#include "Mat3.hpp"

Expand Down Expand Up @@ -26,8 +26,8 @@ Mat3& Mat3::translate(const jngl::Vec2& v) {
}

Mat3& Mat3::translate(const Pixels x, const Pixels y) {
return *this *=
boost::qvm::translation_mat(boost::qvm::vec<double, 2>{ { float(x), float(y) } });
return *this *= boost::qvm::translation_mat(
boost::qvm::vec<double, 2>{ { static_cast<float>(x), static_cast<float>(y) } });
}

Mat3& Mat3::scale(const float factor) {
Expand Down

0 comments on commit 98d6e82

Please sign in to comment.