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

refactor(sonar): make read-only global tables const (cpp:S5421)

Mutable global state (flags, timers, singletons) is left as is.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
jerrrrycho
2026-10-10 17:36:32 +02:00
parent adfad8016e
commit 71d4796649
9 changed files with 9 additions and 9 deletions

View File

@@ -12,7 +12,7 @@ enum class driver_hint {
#ifdef DRIVER_HINT_CONTENT
#define DRIVER_HINT_DEF(a, b) b,
const char *driver_hints_texts[] =
const char *const driver_hints_texts[] =
{
#include "application/driverhints_def.h"
};

View File

@@ -408,7 +408,7 @@ commanddescription_sequence Commands_descriptions = {
};
// Maps of command and coresponding strings
std::unordered_map<std::string, user_command> commandMap = {
std::unordered_map<std::string, user_command> const commandMap = {
{"aidriverdisable", user_command::aidriverdisable},
{"jointcontrollerset", user_command::jointcontrollerset},
{"mastercontrollerincrease", user_command::mastercontrollerincrease},

View File

@@ -517,7 +517,7 @@ extern command_queue Commands;
// TODO: add name to command map, and wrap these two into helper object
extern commanddescription_sequence Commands_descriptions;
extern std::unordered_map<std::string, user_command> commandMap;
extern std::unordered_map<std::string, user_command> const commandMap;
}
// command_relay: composite class component, passes specified command to appropriate command stack

View File

@@ -412,7 +412,7 @@ keyboard_input::poll() {
m_movementvertical = movementvertical;
}
std::unordered_map<int, std::string> keytonamemap = {
std::unordered_map<int, std::string> const keytonamemap = {
{ GLFW_KEY_0, "0" }, { GLFW_KEY_1, "1" }, { GLFW_KEY_2, "2" }, { GLFW_KEY_3, "3" }, { GLFW_KEY_4, "4" },
{ GLFW_KEY_5, "5" }, { GLFW_KEY_6, "6" }, { GLFW_KEY_7, "7" }, { GLFW_KEY_8, "8" }, { GLFW_KEY_9, "9" },
{ GLFW_KEY_MINUS, "-" }, { GLFW_KEY_EQUAL, "=" },

View File

@@ -21,7 +21,7 @@ std::ofstream errors; // lista błędów "errors.txt", zawsze działa
std::ofstream comms; // lista komunikatow "comms.txt", można go wyłączyć
char logbuffer[ 256 ];
char endstring[10] = "\n";
char const endstring[10] = "\n";
std::deque<std::string> log_scrollback;

View File

@@ -10,7 +10,7 @@
#include "simulation/simulationtime.h"
#include "application/application.h"
const char* uart_baudrates_list[] = {
const char* const uart_baudrates_list[] = {
"300",
"1200",
"2400",

View File

@@ -3,7 +3,7 @@
#include <libserialport.h>
#include "input/command.h"
extern const char* uart_baudrates_list[];
extern const char* const uart_baudrates_list[];
extern const size_t uart_baudrates_list_num;
class uart_status {

View File

@@ -421,7 +421,7 @@ void win1250_to_utf32(std::string const &Text, std::u32string &Output)
}
// Ra: tymczasowe rozwiązanie kwestii zagranicznych (czeskich) napisów
char charsetconversiontable[] = "E?,?\"_++?%S<STZZ?`'\"\".--??s>stzz"
char const charsetconversiontable[] = "E?,?\"_++?%S<STZZ?`'\"\".--??s>stzz"
" ^^L$A|S^CS<--RZo±,l'uP.,as>L\"lz"
"RAAAALCCCEEEEIIDDNNOOOOxRUUUUYTB"
"raaaalccceeeeiiddnnoooo-ruuuuyt?";

View File

@@ -18,7 +18,7 @@ namespace Mtable
{
static int const MaxTTableSize = 100; // można by to robić dynamicznie
static char const *hrsd = ".";
static char const *const hrsd = ".";
// Ra: pozycja zerowa rozkładu chyba nie ma sensu
// Ra: numeracja przystanków jest 1..StationCount