From d362d141ca4e9f8037bd9207f081ac901aeec0ff Mon Sep 17 00:00:00 2001 From: falkTX Date: Sun, 26 Nov 2023 11:42:12 +0100 Subject: [PATCH] pluginlist: skip bridge scanning if not enabled in settings Also some cleanup Signed-off-by: falkTX --- .../frontend/pluginlist/pluginlistdialog.cpp | 26 +++++++++++++------ 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/source/frontend/pluginlist/pluginlistdialog.cpp b/source/frontend/pluginlist/pluginlistdialog.cpp index 6d94e41eb..053d48a15 100644 --- a/source/frontend/pluginlist/pluginlistdialog.cpp +++ b/source/frontend/pluginlist/pluginlistdialog.cpp @@ -407,7 +407,7 @@ static QVariant asByteArray(const PluginInfo& info) QByteArray qdata; // start with the POD data, stored as-is - qdata.append(static_cast(static_cast(&info)), sizeof(PluginInfoHeader)); + qdata.append(reinterpret_cast(&info), sizeof(PluginInfoHeader)); // then all the strings, with a null terminating byte { @@ -455,8 +455,8 @@ static PluginInfo asPluginInfo(const QByteArray &qdata) CARLA_SAFE_ASSERT_RETURN(static_cast(qdata.size()) >= sizeof(PluginInfoHeader) + sizeof(char) * 5, {}); // read POD data first - const PluginInfoHeader* const data - = static_cast(static_cast(qdata.constData())); + const PluginInfoHeader* const data = reinterpret_cast(qdata.constData()); + PluginInfo info = {}; info.build = data->build; info.type = data->type; @@ -472,7 +472,7 @@ static PluginInfo asPluginInfo(const QByteArray &qdata) info.parameterOuts = data->parameterOuts; // then all the strings, keeping the same order as in `asVariant` - const char* sdata = static_cast(static_cast(data + 1)); + const char* sdata = reinterpret_cast(data + 1); info.category = QString::fromUtf8(sdata); sdata += info.category.size() + 1; @@ -556,7 +556,7 @@ static QByteArray asByteArray(const PluginFavorite& fav) QByteArray qdata; // start with the POD data, stored as-is - qdata.append(static_cast(static_cast(&fav)), sizeof(PluginFavoriteHeader)); + qdata.append(reinterpret_cast(&fav), sizeof(PluginFavoriteHeader)); // then all the strings, with a null terminating byte { @@ -591,12 +591,11 @@ static PluginFavorite asPluginFavorite(const QByteArray& qdata) CARLA_SAFE_ASSERT_RETURN(static_cast(qdata.size()) >= sizeof(PluginFavoriteHeader) + sizeof(char) * 3, {}); // read POD data first - const PluginFavoriteHeader* const data - = static_cast(static_cast(qdata.constData())); + const PluginFavoriteHeader* const data = reinterpret_cast(qdata.constData()); PluginFavorite fav = { data->type, data->uniqueId, {}, {} }; // then all the strings, keeping the same order as in `asVariant` - const char* sdata = static_cast(static_cast(data + 1)); + const char* sdata = reinterpret_cast(data + 1); fav.filename = QString::fromUtf8(sdata); sdata += fav.filename.size() + 1; @@ -663,6 +662,8 @@ struct PluginListDialog::PrivateData { bool firstInit = true; bool ignoreCache = false; bool checkInvalid = false; + bool usePluginBridges = false; + bool useWineBridges = false; CarlaPluginDiscoveryHandle handle = nullptr; QCarlaString tool; CarlaScopedPointer dialog; @@ -686,6 +687,9 @@ struct PluginListDialog::PrivateData { handle = nullptr; } + if (!usePluginBridges) + return false; + #ifdef CARLA_OS_WIN #ifdef CARLA_OS_WIN64 // look for win32 plugins on win64 @@ -719,6 +723,9 @@ struct PluginListDialog::PrivateData { } #endif + if (!useWineBridges) + return false; + // try wine bridges #ifdef CARLA_OS_64BIT if (btype == BINARY_NATIVE || btype == BINARY_POSIX32) @@ -822,6 +829,9 @@ PluginListDialog::PluginListDialog(QWidget* const parent, const HostSettings* co // ---------------------------------------------------------------------------------------------------------------- // Set-up global discovery options + p->discovery.usePluginBridges = hostSettings->showPluginBridges; + p->discovery.useWineBridges = hostSettings->showWineBridges; + #ifndef CARLA_OS_WIN carla_plugin_discovery_set_option(ENGINE_OPTION_WINE_AUTO_PREFIX, hostSettings->wineAutoPrefix, nullptr); carla_plugin_discovery_set_option(ENGINE_OPTION_WINE_EXECUTABLE, 0, hostSettings->wineExecutable);