diff --git a/plugins/Cardinal/src/Carla.cpp b/plugins/Cardinal/src/Carla.cpp index 40ae9fe..3bbcd83 100644 --- a/plugins/Cardinal/src/Carla.cpp +++ b/plugins/Cardinal/src/Carla.cpp @@ -23,10 +23,12 @@ #include "water/streams/MemoryOutputStream.h" #include "water/xml/XmlDocument.h" -extern "C" { +#ifndef CARDINAL_SYSDEPS // private method that takes ownership, we can use it to avoid superfulous allocations +extern "C" { json_t *jsonp_stringn_nocheck_own(const char* value, size_t len); } +#endif #define BUFFER_SIZE 128 @@ -245,7 +247,11 @@ struct CarlaModule : Module { engine->saveProjectInternal(projectState); const size_t dataSize = projectState.getDataSize(); +#ifndef CARDINAL_SYSDEPS return jsonp_stringn_nocheck_own(static_cast(projectState.getDataAndRelease()), dataSize); +#else + return json_stringn(static_cast(projectState.getData()), dataSize); +#endif } void dataFromJson(json_t* const rootJ) override diff --git a/plugins/Cardinal/src/Ildaeil.cpp b/plugins/Cardinal/src/Ildaeil.cpp index d401b06..b3bb020 100644 --- a/plugins/Cardinal/src/Ildaeil.cpp +++ b/plugins/Cardinal/src/Ildaeil.cpp @@ -26,10 +26,12 @@ #include "water/streams/MemoryOutputStream.h" #include "water/xml/XmlDocument.h" -extern "C" { +#ifndef CARDINAL_SYSDEPS // private method that takes ownership, we can use it to avoid superfulous allocations +extern "C" { json_t *jsonp_stringn_nocheck_own(const char* value, size_t len); } +#endif #define BUFFER_SIZE 128 @@ -237,7 +239,11 @@ struct IldaeilModule : Module { engine->saveProjectInternal(projectState); const size_t dataSize = projectState.getDataSize(); +#ifndef CARDINAL_SYSDEPS return jsonp_stringn_nocheck_own(static_cast(projectState.getDataAndRelease()), dataSize); +#else + return json_stringn(static_cast(projectState.getData()), dataSize); +#endif } void dataFromJson(json_t* const rootJ) override diff --git a/plugins/Makefile b/plugins/Makefile index 50cf8f9..7db60b0 100644 --- a/plugins/Makefile +++ b/plugins/Makefile @@ -531,7 +531,9 @@ BASE_FLAGS += -I../src/Rack/dep/oui-blendish BASE_FLAGS += -I../src/Rack/dep/pffft BASE_FLAGS += -pthread -ifneq ($(SYSDEPS),true) +ifeq ($(SYSDEPS),true) +BASE_FLAGS += -DCARDINAL_SYSDEPS +else BASE_FLAGS += -DZSTDLIB_VISIBILITY= BASE_FLAGS += -I../src/Rack/dep/include endif diff --git a/src/Makefile b/src/Makefile index 81d5a6a..59b0798 100644 --- a/src/Makefile +++ b/src/Makefile @@ -36,6 +36,7 @@ BASE_FLAGS += -I../include BASE_FLAGS += -I../include/neon-compat BASE_FLAGS += -IRack/include ifeq ($(SYSDEPS),true) +BASE_FLAGS += -DCARDINAL_SYSDEPS BASE_FLAGS += $(shell pkg-config --cflags jansson libarchive samplerate speexdsp) else BASE_FLAGS += -DZSTDLIB_VISIBILITY= diff --git a/src/Makefile.cardinal.mk b/src/Makefile.cardinal.mk index 7d676d7..cbabd0d 100644 --- a/src/Makefile.cardinal.mk +++ b/src/Makefile.cardinal.mk @@ -133,9 +133,10 @@ BASE_FLAGS += -I../../include BASE_FLAGS += -I../../include/neon-compat BASE_FLAGS += -I../Rack/include ifeq ($(SYSDEPS),true) -BASE_FLAGS += -DZSTDLIB_VISIBILITY= +BASE_FLAGS += -DCARDINAL_SYSDEPS BASE_FLAGS += $(shell pkg-config --cflags jansson libarchive samplerate speexdsp) else +BASE_FLAGS += -DZSTDLIB_VISIBILITY= BASE_FLAGS += -I../Rack/dep/include endif BASE_FLAGS += -I../Rack/dep/glfw/include