17
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-10-17 10:59:20 +02:00

refactor(sonar): make read-only local references and pointers const (cpp:S5350)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
jerrrrycho
2026-10-10 17:05:09 +02:00
parent 3a6f21eb2d
commit d7edea6fac
16 changed files with 38 additions and 38 deletions

View File

@@ -363,7 +363,7 @@ void python_taskqueue::exit()
// which the previous code did not do (cancel() is a no-op stub).
{
std::scoped_lock lock(m_tasks.mutex);
for (auto &task : m_tasks.data)
for (auto const &task : m_tasks.data)
{
task->cancel();
}
@@ -609,7 +609,7 @@ void python_taskqueue::update()
{
std::scoped_lock lock(m_uploadtasks.mutex);
for (auto &task : m_uploadtasks.data)
for (auto const &task : m_uploadtasks.data)
task->upload();
m_uploadtasks.data.clear();

View File

@@ -79,7 +79,7 @@ python_screen_viewer::~python_screen_viewer()
void python_screen_viewer::threadfunc()
{
for (auto &window : m_windows) {
for (auto const &window : m_windows) {
glfwMakeContextCurrent(window->window);
glfwSwapInterval(Global.python_vsync ? 1 : 0);
@@ -115,7 +115,7 @@ void python_screen_viewer::threadfunc()
{
auto start_time = std::chrono::high_resolution_clock::now();
for (auto &window : m_windows) {
for (auto const &window : m_windows) {
unsigned char *image = nullptr;
int format;
@@ -190,7 +190,7 @@ void python_screen_viewer::threadfunc()
void python_screen_viewer::notify_window_fb_size(GLFWwindow *window, int w, int h) const
{
for (auto &conf : m_windows) {
for (auto const &conf : m_windows) {
if (conf->window == window) {
conf->fb_size.x = w;
conf->fb_size.y = h;
@@ -201,7 +201,7 @@ void python_screen_viewer::notify_window_fb_size(GLFWwindow *window, int w, int
void python_screen_viewer::notify_window_size(GLFWwindow *window, int w, int h) const
{
for (auto &conf : m_windows) {
for (auto const &conf : m_windows) {
if (conf->window == window) {
conf->window_size.x = w;
conf->window_size.y = h;
@@ -212,7 +212,7 @@ void python_screen_viewer::notify_window_size(GLFWwindow *window, int w, int h)
void python_screen_viewer::notify_cursor_pos(GLFWwindow *window, double x, double y) const
{
for (auto &conf : m_windows) {
for (auto const &conf : m_windows) {
if (conf->window == window) {
conf->cursor_pos.x = static_cast<int>(x);
conf->cursor_pos.y = static_cast<int>(y);
@@ -226,7 +226,7 @@ void python_screen_viewer::notify_click(GLFWwindow *window, int button, int acti
if (button != GLFW_MOUSE_BUTTON_LEFT || action != GLFW_PRESS)
return;
for (auto &conf : m_windows) {
for (auto const &conf : m_windows) {
if (conf->window == window) {
auto pos = glm::vec2(conf->cursor_pos) / glm::vec2(conf->window_size);
pos.y = 1.0f - pos.y;