DPF

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

commit 63dfb7610bc37dee69f4a303f3e3362529d95f24
parent c24763e9b3ed2eaabef646ccbee7372ccee7f6fa
Author: falkTX <falktx@falktx.com>
Date:   Fri, 29 Sep 2023 19:36:26 +0200

Reduce scope of ScopedSafeLocale usage on VST2, following others

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

Diffstat:
Mdistrho/src/DistrhoPluginVST2.cpp | 16+++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/distrho/src/DistrhoPluginVST2.cpp b/distrho/src/DistrhoPluginVST2.cpp @@ -757,7 +757,7 @@ public: } } - const std::size_t chunkSize(chunkStr.length()+1); + const std::size_t chunkSize = chunkStr.length()+1; fStateChunk = new char[chunkSize]; std::memcpy(fStateChunk, chunkStr.buffer(), chunkStr.length()); @@ -819,9 +819,6 @@ public: ++key; float fvalue; - // temporarily set locale to "C" while converting floats - const ScopedSafeLocale ssl; - while (bytesRead < chunkSize) { if (key[0] == '\0') @@ -839,7 +836,16 @@ public: if (fPlugin.getParameterSymbol(i) != key) continue; - fvalue = std::atof(value); + if (fPlugin.getParameterHints(i) & kParameterIsInteger) + { + fvalue = std::atoi(value); + } + else + { + const ScopedSafeLocale ssl; + fvalue = std::atof(value); + } + fPlugin.setParameterValue(i, fvalue); #if DISTRHO_PLUGIN_HAS_UI if (fVstUI != nullptr)