From e659e4b33defc709fe3129b4a6420deaef67e6b4 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Fri, 12 May 2023 09:15:44 -0400 Subject: Replace macro with typed constant --- src/Configuration.cpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'src/Configuration.cpp') 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 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() << 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; -- cgit v1.2.1