diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/JackDriver.cpp | 2 | ||||
-rw-r--r-- | src/Patchage.cpp | 13 | ||||
-rw-r--r-- | src/PortID.hpp | 4 | ||||
-rw-r--r-- | src/binary_location.h | 22 |
4 files changed, 23 insertions, 18 deletions
diff --git a/src/JackDriver.cpp b/src/JackDriver.cpp index 82f9b87..fe09ad4 100644 --- a/src/JackDriver.cpp +++ b/src/JackDriver.cpp @@ -50,7 +50,7 @@ JackDriver::JackDriver(Patchage* app) , _is_activated(false) { _last_pos.frame = 0; - _last_pos.valid = (jack_position_bits_t)0; + _last_pos.valid = {}; } JackDriver::~JackDriver() diff --git a/src/Patchage.cpp b/src/Patchage.cpp index b8f55cd..678967a 100644 --- a/src/Patchage.cpp +++ b/src/Patchage.cpp @@ -292,8 +292,10 @@ Patchage::Patchage(int argc, char** argv) } for (int s = Gtk::STATE_NORMAL; s <= Gtk::STATE_INSENSITIVE; ++s) { - _status_text->modify_base((Gtk::StateType)s, Gdk::Color("#000000")); - _status_text->modify_text((Gtk::StateType)s, Gdk::Color("#FFFFFF")); + _status_text->modify_base(static_cast<Gtk::StateType>(s), + Gdk::Color("#000000")); + _status_text->modify_text(static_cast<Gtk::StateType>(s), + Gdk::Color("#FFFFFF")); } _error_tag = Gtk::TextTag::create(); @@ -497,14 +499,14 @@ Patchage::update_toolbar() const jack_nframes_t sample_rate = _jack_driver->sample_rate(); if (sample_rate != 0) { const int latency_ms = - lrintf(buffer_size * 1000 / (float)sample_rate); + lrintf(buffer_size * 1000 / float(sample_rate)); std::stringstream ss; ss << " frames @ " << (sample_rate / 1000) << "kHz (" << latency_ms << "ms)"; _latency_label->set_label(ss.str()); _latency_label->set_visible(true); _buf_size_combo->set_active( - (int)log2f(_jack_driver->buffer_size()) - 5); + static_cast<int>(log2f(_jack_driver->buffer_size()) - 5)); updating = false; return; } @@ -914,8 +916,7 @@ highlight_color(guint c, guint delta) const guint b = MIN(((c >> 8) & 0xFF) + delta, max_char); const guint a = c & 0xFF; - return ((((guint)(r)) << 24) | (((guint)(g)) << 16) | (((guint)(b)) << 8) | - (((guint)(a)))); + return ((r << 24u) | (g << 16u) | (b << 8u) | a); } static void diff --git a/src/PortID.hpp b/src/PortID.hpp index 3dea5af..06d25ec 100644 --- a/src/PortID.hpp +++ b/src/PortID.hpp @@ -95,8 +95,8 @@ operator<<(std::ostream& os, const PortID& id) break; case PortID::Type::alsa_addr: #ifdef HAVE_ALSA - return os << "alsa:" << (int)id.id.alsa_addr.client << ":" - << (int)id.id.alsa_addr.port << ":" + return os << "alsa:" << int(id.id.alsa_addr.client) << ":" + << int(id.id.alsa_addr.port) << ":" << (id.id.is_input ? "in" : "out"); #endif break; diff --git a/src/binary_location.h b/src/binary_location.h index 3705d94..f949649 100644 --- a/src/binary_location.h +++ b/src/binary_location.h @@ -1,5 +1,5 @@ /* This file is part of Patchage. - * Copyright 2008-2014 David Robillard <http://drobilla.net> + * Copyright 2008-2020 David Robillard <d@drobilla.net> * * Patchage is free software: you can redistribute it and/or modify it under * the terms of the GNU General Public License as published by the Free @@ -29,15 +29,19 @@ inline std::string binary_location() { - Dl_info dli; - std::string loc; - const int ret = dladdr((void*)&binary_location, &dli); - if (ret) { - if (char* const bin_loc = realpath(dli.dli_fname, nullptr)) { - loc = bin_loc; - free(bin_loc); - } + Dl_info dli = {}; + const int ret = dladdr(reinterpret_cast<void*>(&binary_location), &dli); + if (!ret) { + return ""; } + + char* const bin_loc = realpath(dli.dli_fname, nullptr); + if (!bin_loc) { + return ""; + } + + std::string loc{bin_loc}; + free(bin_loc); return loc; } |