From af5ec4bdda21e9a2f76f22050216a0b1cbbed575 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sun, 9 Feb 2020 14:34:20 +0100 Subject: Format all code with clang-format This configuration tries to get as close to the previous style as possible so the changes aren't too dramatic. It's still far from ideal and the code could use some adaptation, but this makes things much easier to work on. --- src/PortID.hpp | 58 ++++++++++++++++++++++++++++++++++++++++------------------ 1 file changed, 40 insertions(+), 18 deletions(-) (limited to 'src/PortID.hpp') diff --git a/src/PortID.hpp b/src/PortID.hpp index f8e530f..01a8ec4 100644 --- a/src/PortID.hpp +++ b/src/PortID.hpp @@ -22,39 +22,60 @@ #include "PatchagePort.hpp" #ifdef PATCHAGE_LIBJACK - #include +# include #endif #ifdef HAVE_ALSA - #include +# include #endif #include #include -struct PortID { - PortID() : type(NULL_PORT_ID) { memset(&id, 0, sizeof(id)); } - PortID(const PortID& copy) : type(copy.type) { +struct PortID +{ + PortID() + : type(NULL_PORT_ID) + { + memset(&id, 0, sizeof(id)); + } + PortID(const PortID& copy) + : type(copy.type) + { memcpy(&id, ©.id, sizeof(id)); } - enum { NULL_PORT_ID, JACK_ID, ALSA_ADDR } type; + enum + { + NULL_PORT_ID, + JACK_ID, + ALSA_ADDR + } type; #ifdef PATCHAGE_LIBJACK - PortID(jack_port_id_t jack_id, bool ign=false) - : type(JACK_ID) { id.jack_id = jack_id; } + PortID(jack_port_id_t jack_id, bool ign = false) + : type(JACK_ID) + { + id.jack_id = jack_id; + } #endif #ifdef HAVE_ALSA PortID(snd_seq_addr_t addr, bool in) - : type(ALSA_ADDR) { id.alsa_addr = addr; id.is_input = in; } + : type(ALSA_ADDR) + { + id.alsa_addr = addr; + id.is_input = in; + } #endif - union { + union + { #ifdef PATCHAGE_LIBJACK jack_port_id_t jack_id; #endif #ifdef HAVE_ALSA - struct { + struct + { snd_seq_addr_t alsa_addr; bool is_input : 1; }; @@ -75,8 +96,9 @@ operator<<(std::ostream& os, const PortID& id) break; case PortID::ALSA_ADDR: #ifdef HAVE_ALSA - return os << "alsa:" << (int)id.id.alsa_addr.client << ":" << (int)id.id.alsa_addr.port - << ":" << (id.id.is_input ? "in" : "out"); + return os << "alsa:" << (int)id.id.alsa_addr.client << ":" + << (int)id.id.alsa_addr.port << ":" + << (id.id.is_input ? "in" : "out"); #endif break; } @@ -100,12 +122,12 @@ operator<(const PortID& a, const PortID& b) break; case PortID::ALSA_ADDR: #ifdef HAVE_ALSA - if ((a.id.alsa_addr.client < b.id.alsa_addr.client) - || ((a.id.alsa_addr.client == b.id.alsa_addr.client) - && a.id.alsa_addr.port < b.id.alsa_addr.port)) { + if ((a.id.alsa_addr.client < b.id.alsa_addr.client) || + ((a.id.alsa_addr.client == b.id.alsa_addr.client) && + a.id.alsa_addr.port < b.id.alsa_addr.port)) { return true; - } else if (a.id.alsa_addr.client == b.id.alsa_addr.client - && a.id.alsa_addr.port == b.id.alsa_addr.port) { + } else if (a.id.alsa_addr.client == b.id.alsa_addr.client && + a.id.alsa_addr.port == b.id.alsa_addr.port) { return (a.id.is_input < b.id.is_input); } else { return false; -- cgit v1.2.1