Fix warnings in Clang build (#6893)

* Fix unused variable warning

* Fix implicit conversion warning

* Fix unused lambda capture in DataFile.cpp

* Fix implicit conversions in InstrumentFunctions.cpp

* Fix operator precedence bug in Flags.h

* Fix unused variable warning in Lv2UridMap.h

* Fix unused lambda capture in MixerView.cpp

* Fix unused lambda captures in SetupDialog.cpp

* Fix unused lambda capture in TrackOperationsWidget.cpp

* Fix MSVC build

* Fix style

* Remove unused member variable in Lv2UridMap.h
This commit is contained in:
Dalton Messmer
2023-09-28 20:23:35 -04:00
committed by GitHub
parent 23ef89b4a1
commit 8fb9c3e6a2
9 changed files with 15 additions and 16 deletions

View File

@@ -48,8 +48,8 @@ public:
m_value{value}
{}
constexpr auto testAll(Flags flags) const -> bool { return *this & flags == flags; }
constexpr auto testAny(Flags flags) const -> bool { return *this & flags != Flags{}; }
constexpr auto testAll(Flags flags) const -> bool { return (*this & flags) == flags; }
constexpr auto testAny(Flags flags) const -> bool { return (*this & flags) != Flags{}; }
constexpr auto testFlag(EnumType flag) const -> bool { return static_cast<bool>(*this & flag); }
constexpr auto operator~() const -> Flags { return Flags{~m_value}; }

View File

@@ -55,8 +55,6 @@ class UridMap
LV2_URID_Map m_mapFeature;
LV2_URID_Unmap m_unmapFeature;
LV2_URID m_lastUrid = 0;
public:
//! constructor; will set up the features
UridMap();

View File

@@ -212,7 +212,7 @@ private:
int32_t m_sysExDataLen; // len of m_sysExData
} m_data;
const char* m_sysExData;
[[maybe_unused]] const char* m_sysExData;
const void* m_sourcePort;
// Stores the source of the MidiEvent: Internal or External (hardware controllers).

View File

@@ -302,7 +302,7 @@ void DataFile::write( QTextStream & _strm )
bool DataFile::writeFile(const QString& filename, bool withResources)
{
// Small lambda function for displaying errors
auto showError = [this](QString title, QString body){
auto showError = [](QString title, QString body){
if (gui::getGUI() != nullptr)
{
QMessageBox mb;

View File

@@ -273,7 +273,9 @@ int DrumSynth::GetDSFileSamples(QString dsfile, int16_t *&wave, int channels, sa
//generation
long Length, tpos=0, tplus, totmp, t, i, j;
float x[3] = {0.f, 0.f, 0.f};
float MasterTune, randmax, randmax2;
float MasterTune;
constexpr float randmax = 1.f / static_cast<float>(RAND_MAX);
constexpr float randmax2 = 2.f / static_cast<float>(RAND_MAX);
int MainFilter, HighPass;
long NON, NT, TON, DiON, TDroop=0, DStep;
@@ -454,7 +456,6 @@ int DrumSynth::GetDSFileSamples(QString dsfile, int16_t *&wave, int channels, sa
}
//prepare envelopes
randmax = 1.f / RAND_MAX; randmax2 = 2.f * randmax;
for (i=1;i<8;i++) { envData[i][NEXTT]=0; envData[i][PNT]=0; }
Length = LongestEnv();
@@ -745,4 +746,4 @@ int DrumSynth::GetDSFileSamples(QString dsfile, int16_t *&wave, int channels, sa
}
} // namespace lmms
} // namespace lmms

View File

@@ -409,7 +409,7 @@ void InstrumentFunctionArpeggio::processNote( NotePlayHandle * _n )
// Skip notes randomly
if( m_arpSkipModel.value() )
{
if( 100 * ( (float) rand() / (float)( RAND_MAX + 1.0f ) ) < m_arpSkipModel.value() )
if (100 * static_cast<float>(rand()) / (static_cast<float>(RAND_MAX) + 1.0f) < m_arpSkipModel.value())
{
// update counters
frames_processed += arp_frames;
@@ -425,7 +425,7 @@ void InstrumentFunctionArpeggio::processNote( NotePlayHandle * _n )
if( m_arpMissModel.value() )
{
if( 100 * ( (float) rand() / (float)( RAND_MAX + 1.0f ) ) < m_arpMissModel.value() )
if (100 * static_cast<float>(rand()) / (static_cast<float>(RAND_MAX) + 1.0f) < m_arpMissModel.value())
{
dir = ArpDirection::Random;
}

View File

@@ -464,7 +464,7 @@ bool MixerView::confirmRemoval(int index)
QString messageTitleRemoveTrack = tr("Confirm removal");
QString askAgainText = tr("Don't ask again");
auto askAgainCheckBox = new QCheckBox(askAgainText, nullptr);
connect(askAgainCheckBox, &QCheckBox::stateChanged, [this](int state) {
connect(askAgainCheckBox, &QCheckBox::stateChanged, [](int state) {
// Invert button state, if it's checked we *shouldn't* ask again
ConfigManager::inst()->setValue("ui", "mixerchanneldeletionwarning", state ? "0" : "1");
});

View File

@@ -168,8 +168,8 @@ SetupDialog::SetupDialog(ConfigTab tab_to_open) :
// Constants for positioning LED check boxes.
const int XDelta = 10;
const int YDelta = 18;
constexpr int XDelta = 10;
constexpr int YDelta = 18;
// Main widget.
auto main_w = new QWidget(this);
@@ -212,7 +212,7 @@ SetupDialog::SetupDialog(ConfigTab tab_to_open) :
auto generalControlsLayout = new QVBoxLayout;
generalControlsLayout->setSpacing(10);
auto addLedCheckBox = [&XDelta, &YDelta, this](const QString& ledText, TabWidget* tw, int& counter,
auto addLedCheckBox = [&](const QString& ledText, TabWidget* tw, int& counter,
bool initialState, const char* toggledSlot, bool showRestartWarning) {
auto checkBox = new LedCheckBox(ledText, tw);
counter++;

View File

@@ -195,7 +195,7 @@ bool TrackOperationsWidget::confirmRemoval()
QString messageTitleRemoveTrack = tr("Confirm removal");
QString askAgainText = tr("Don't ask again");
auto askAgainCheckBox = new QCheckBox(askAgainText, nullptr);
connect(askAgainCheckBox, &QCheckBox::stateChanged, [this](int state){
connect(askAgainCheckBox, &QCheckBox::stateChanged, [](int state){
// Invert button state, if it's checked we *shouldn't* ask again
ConfigManager::inst()->setValue("ui", "trackdeletionwarning", state ? "0" : "1");
});