Skip to content

Commit

Permalink
Reduce scope of ScopedSafeLocale usage on VST2, following others
Browse files Browse the repository at this point in the history
Signed-off-by: falkTX <falktx@falktx.com>
  • Loading branch information
falkTX committed Sep 29, 2023
1 parent c24763e commit 63dfb76
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions distrho/src/DistrhoPluginVST2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -757,7 +757,7 @@ class PluginVst : public ParameterAndNotesHelper
}
}

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());
Expand Down Expand Up @@ -819,9 +819,6 @@ class PluginVst : public ParameterAndNotesHelper
++key;
float fvalue;

// temporarily set locale to "C" while converting floats
const ScopedSafeLocale ssl;

while (bytesRead < chunkSize)
{
if (key[0] == '\0')
Expand All @@ -839,7 +836,16 @@ class PluginVst : public ParameterAndNotesHelper
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)
Expand Down

0 comments on commit 63dfb76

Please sign in to comment.