DPF

DISTRHO Plugin Framework
Log | Files | Refs | Submodules | README | LICENSE

commit 96dcfa87d7bc3e7ec7f2fd358c2ffe4eea7fa21f
parent 6d29d5d83d856ada7aef96400c99bdd567796a2e
Author: falkTX <falktx@falktx.com>
Date:   Sun, 19 Sep 2021 11:47:13 +0100

Correct checks in the previous commit

Signed-off-by: falkTX <falktx@falktx.com>

Diffstat:
Mdistrho/src/DistrhoPlugin.cpp | 24+++++++++++++++++++-----
Mdistrho/src/DistrhoPluginInternal.hpp | 19++-----------------
2 files changed, 21 insertions(+), 22 deletions(-)

diff --git a/distrho/src/DistrhoPlugin.cpp b/distrho/src/DistrhoPlugin.cpp @@ -44,28 +44,42 @@ Plugin::Plugin(uint32_t parameterCount, uint32_t programCount, uint32_t stateCou pData->audioPorts = new AudioPort[DISTRHO_PLUGIN_NUM_INPUTS+DISTRHO_PLUGIN_NUM_OUTPUTS]; #endif +#ifdef DPF_ABORT_ON_ERROR +# define DPF_ABORT abort(); +#else +# define DPF_ABORT +#endif + if (parameterCount > 0) { pData->parameterCount = parameterCount; pData->parameters = new Parameter[parameterCount]; } -#if DISTRHO_PLUGIN_WANT_PROGRAMS if (programCount > 0) { +#if DISTRHO_PLUGIN_WANT_PROGRAMS pData->programCount = programCount; pData->programNames = new String[programCount]; - } +#else + d_stderr2("DPF warning: Plugins with programs must define `DISTRHO_PLUGIN_WANT_PROGRAMS` to 1"); + DPF_ABORT #endif + } -#if DISTRHO_PLUGIN_WANT_STATE if (stateCount > 0) { +#if DISTRHO_PLUGIN_WANT_STATE pData->stateCount = stateCount; pData->stateKeys = new String[stateCount]; pData->stateDefValues = new String[stateCount]; - } +#else + d_stderr2("DPF warning: Plugins with state must define `DISTRHO_PLUGIN_WANT_STATE` to 1"); + DPF_ABORT #endif + } + +#undef DPF_ABORT } Plugin::~Plugin() @@ -156,7 +170,7 @@ void Plugin::initState(uint32_t, String&, String&) {} #endif #if DISTRHO_PLUGIN_WANT_STATEFILES -bool Plugin::isStateFile(uint32_t index) { return false; } +bool Plugin::isStateFile(uint32_t) { return false; } #endif /* ------------------------------------------------------------------------------------------------------------ diff --git a/distrho/src/DistrhoPluginInternal.hpp b/distrho/src/DistrhoPluginInternal.hpp @@ -288,12 +288,6 @@ public: DPF_ABORT } } -# else - if (fData->programCount != 0) - { - d_stderr2("DPF warning: Plugins with programs must define `DISTRHO_PLUGIN_WANT_PROGRAMS` to 1"); - DPF_ABORT - } # endif # if DISTRHO_PLUGIN_WANT_STATE @@ -311,12 +305,6 @@ public: DPF_ABORT } } -# else - if (fData->stateCount != 0) - { - d_stderr2("DPF warning: Plugins with state must define `DISTRHO_PLUGIN_WANT_STATE` to 1"); - DPF_ABORT - } # endif # if DISTRHO_PLUGIN_WANT_FULL_STATE @@ -330,11 +318,8 @@ public: } else { - if (fData->stateCount == 0) - { - d_stderr2("DPF warning: Plugins with full state must have at least 1 state"); - DPF_ABORT - } + d_stderr2("DPF warning: Plugins with full state must have at least 1 state"); + DPF_ABORT } # endif