summaryrefslogtreecommitdiffstats
path: root/src/Configuration.cpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2023-05-12 09:15:44 -0400
committerDavid Robillard <d@drobilla.net>2023-05-12 09:15:44 -0400
commite659e4b33defc709fe3129b4a6420deaef67e6b4 (patch)
treeeb68d8d3dc50f42b7716526516eb293973d77d87 /src/Configuration.cpp
parent8987e2ab771b8494269387e57e670866307fe1bc (diff)
downloadpatchage-e659e4b33defc709fe3129b4a6420deaef67e6b4.tar.gz
patchage-e659e4b33defc709fe3129b4a6420deaef67e6b4.tar.bz2
patchage-e659e4b33defc709fe3129b4a6420deaef67e6b4.zip
Replace macro with typed constant
Diffstat (limited to 'src/Configuration.cpp')
-rw-r--r--src/Configuration.cpp11
1 files changed, 4 insertions, 7 deletions
diff --git a/src/Configuration.cpp b/src/Configuration.cpp
index 7bc2b20..5edbbf1 100644
--- a/src/Configuration.cpp
+++ b/src/Configuration.cpp
@@ -22,11 +22,8 @@
namespace patchage {
-static const char* const port_type_names[N_PORT_TYPES] = {"JACK_AUDIO",
- "JACK_MIDI",
- "ALSA_MIDI",
- "JACK_OSC",
- "JACK_CV"};
+static const char* const port_type_names[Configuration::n_port_types] =
+ {"JACK_AUDIO", "JACK_MIDI", "ALSA_MIDI", "JACK_OSC", "JACK_CV"};
Configuration::Configuration(std::function<void(const Setting&)> on_change)
: _on_change(std::move(on_change))
@@ -246,7 +243,7 @@ Configuration::load()
file >> std::dec >> std::nouppercase;
bool found = false;
- for (int i = 0; i < N_PORT_TYPES; ++i) {
+ for (unsigned i = 0U; i < n_port_types; ++i) {
if (type_name == port_type_names[i]) {
_port_colors[i] = rgba;
found = true;
@@ -343,7 +340,7 @@ Configuration::save()
file << "human_names " << get<setting::HumanNames>() << std::endl;
file << std::hex << std::uppercase;
- for (int i = 0; i < N_PORT_TYPES; ++i) {
+ for (unsigned i = 0U; i < n_port_types; ++i) {
if (_port_colors[i] != _default_port_colors[i]) {
file << "port_color " << port_type_names[i] << " " << _port_colors[i]
<< std::endl;