Browse Source

jsfx: read/compile under scoped locale everywhere

pull/1503/head
Jean Pierre Cimalando Filipe Coelho <falktx@falktx.com> 3 years ago
parent
commit
f80662f878
3 changed files with 27 additions and 11 deletions
  1. +12
    -5
      source/backend/plugin/CarlaPluginJSFX.cpp
  2. +7
    -3
      source/backend/utils/CachedPlugins.cpp
  3. +8
    -3
      source/discovery/carla-discovery.cpp

+ 12
- 5
source/backend/plugin/CarlaPluginJSFX.cpp View File

@@ -22,6 +22,7 @@
#include "CarlaEngine.hpp"
#include "CarlaJsfxUtils.hpp"
#include "CarlaBackendUtils.hpp"
#include "CarlaScopeUtils.hpp"
#include "CarlaUtils.hpp"

#include "water/files/File.h"
@@ -287,8 +288,11 @@ public:
| JsusFx::kCompileFlag_CompileSerializeSection
;

if (!fEffect->compile(*fPathLibrary, fFilename, compileFlags))
carla_stderr("Failed to compile JSFX");
{
const CarlaScopedLocale csl;
if (!fEffect->compile(*fPathLibrary, fFilename, compileFlags))
carla_stderr("Failed to compile JSFX");
}

// initialize the block size and sample rate
// loading the chunk can invoke @slider which makes computations based on these
@@ -854,10 +858,13 @@ public:
// ---------------------------------------------------------------
// get info

if (!fEffect->readHeader(*fPathLibrary, filename))
{
pData->engine->setLastError("Cannot read the JSFX header");
return false;
const CarlaScopedLocale csl;
if (!fEffect->readHeader(*fPathLibrary, filename))
{
pData->engine->setLastError("Cannot read the JSFX header");
return false;
}
}

// jsusfx lacks validity checks currently,


+ 7
- 3
source/backend/utils/CachedPlugins.cpp View File

@@ -20,6 +20,7 @@
#include "CarlaNative.h"
#include "CarlaString.hpp"
#include "CarlaBackendUtils.hpp"
#include "CarlaScopeUtils.hpp"
#include "CarlaLv2Utils.hpp"
#include "CarlaJsfxUtils.hpp"

@@ -673,10 +674,13 @@ static const CarlaCachedPluginInfo* get_cached_plugin_jsfx(const water::File& fi
name = file.getFileNameWithoutExtension().toRawUTF8();
filename = file.getFullPathName().toRawUTF8();

if (!effect.readHeader(pathLibrary, filename.buffer()))
{
info.valid = false;
return &info;
const CarlaScopedLocale csl;
if (!effect.readHeader(pathLibrary, filename.buffer()))
{
info.valid = false;
return &info;
}
}
if (effect.desc[0] == '\0')
{


+ 8
- 3
source/discovery/carla-discovery.cpp View File

@@ -18,6 +18,7 @@
#include "CarlaBackendUtils.hpp"
#include "CarlaLibUtils.hpp"
#include "CarlaMathUtils.hpp"
#include "CarlaScopeUtils.hpp"
#include "CarlaMIDI.h"
#include "LinkedList.hpp"

@@ -1689,10 +1690,13 @@ static void do_jsfx_check(const char* const filename, bool doInit)
JsusFx::kCompileFlag_CompileSerializeSection |
JsusFx::kCompileFlag_CompileGraphicsSection;

if (!effect.compile(pathLibrary, filename, compileFlags))
{
DISCOVERY_OUT("error", "Cannot compile the JSFX plugin");
return;
const CarlaScopedLocale csl;
if (!effect.compile(pathLibrary, filename, compileFlags))
{
DISCOVERY_OUT("error", "Cannot compile the JSFX plugin");
return;
}
}

#if 0 // TODO(jsfx) when supporting custom graphics
@@ -1703,6 +1707,7 @@ static void do_jsfx_check(const char* const filename, bool doInit)
}
else
{
const CarlaScopedLocale csl;
if (!effect.readHeader(pathLibrary, filename))
{
DISCOVERY_OUT("error", "Cannot read the JSFX header");


Loading…
Cancel
Save