diff --git a/source/tests/Print.cpp b/source/tests/Print.cpp index a9f7d6e01..d5b6fd1df 100644 --- a/source/tests/Print.cpp +++ b/source/tests/Print.cpp @@ -25,5 +25,3 @@ int main() carla_stderr2("STDERR2"); return 0; } - -#include "../utils/Utils.cpp" diff --git a/source/tests/Utils.cpp b/source/tests/Utils.cpp index 101517e56..cc7854a0d 100644 --- a/source/tests/Utils.cpp +++ b/source/tests/Utils.cpp @@ -16,15 +16,31 @@ */ #include "CarlaUtils.hpp" -#include "CarlaLibUtils.hpp" -#include "CarlaJuceUtils.hpp" +#include "CarlaBackendUtils.hpp" +#include "CarlaBridgeUtils.hpp" +// #include "CarlaDssiUtils.hpp" +#include "CarlaJuceUtils.hpp" +#include "CarlaLadspaUtils.hpp" +#include "CarlaLibUtils.hpp" +// #include "CarlaLv2Utils.hpp" +#include "CarlaOscUtils.hpp" +#include "CarlaPipeUtils.hpp" +#include "CarlaShmUtils.hpp" +// #include "CarlaStateUtils.hpp" +#include "CarlaVstUtils.hpp" + +#include "CarlaLibCounter.hpp" +//#include "CarlaLogThread.hpp" #include "CarlaMutex.hpp" +#include "CarlaRingBuffer.hpp" #include "CarlaString.hpp" #include "CarlaThread.hpp" +#include "List.hpp" +#include "Lv2AtomQueue.hpp" +#include "RtList.hpp" -#include -#include +//#include "JucePluginWindow.hpp" struct MyStruct { char pad[100]; @@ -76,6 +92,10 @@ protected: carla_sleep(1); carla_stderr("Thread finished"); + + return; + + vstPluginCanDo(nullptr, "something"); } private: @@ -264,5 +284,3 @@ int main() return 0; } - -#include "../utils/Utils.cpp" diff --git a/source/utils/CarlaPipeUtils.hpp b/source/utils/CarlaPipeUtils.hpp index 57006c347..0752fcab6 100644 --- a/source/utils/CarlaPipeUtils.hpp +++ b/source/utils/CarlaPipeUtils.hpp @@ -66,7 +66,7 @@ public: //---------------------------------------------------------------- - const char* argv[6]; + const char* argv[5]; //---------------------------------------------------------------- // argv[0] => filename @@ -109,11 +109,6 @@ public: argv[3] = uiPipeRecv; // reading end argv[4] = uiPipeSend; // writting end - //---------------------------------------------------------------- - // argv[5] => NULL - - argv[5] = nullptr; - //---------------------------------------------------------------- // fork @@ -147,9 +142,9 @@ public: for (int i=0; ;) { - ret = read(fPipeRecv, &ch, 1); + ssize_t ret2 = read(fPipeRecv, &ch, 1); - switch (ret) + switch (ret2) { case -1: if (errno == EAGAIN) @@ -176,7 +171,7 @@ public: break; default: - carla_stderr("read() returned %d", ret); + carla_stderr("read() returned %d", ret2); break; } @@ -267,7 +262,7 @@ public: if (char* const msg = readline()) { - value = atoi(msg); + value = std::atoi(msg); std::free(msg); return true; } @@ -282,7 +277,7 @@ public: if (char* const msg = readline()) { - bool ret = (sscanf(msg, "%f", &value) == 1); + bool ret = (std::sscanf(msg, "%f", &value) == 1); std::free(msg); return ret; } @@ -416,18 +411,18 @@ private: return nullptr; } - static bool fork_exec(const char* const argv[6], int* const retp) + static bool fork_exec(const char* const argv[5], int* const retp) { pid_t ret = *retp = vfork(); switch (ret) { case 0: /* child process */ - execvp(argv[0], (char* const*)argv); - carla_stderr2("exec of UI failed: %s", strerror(errno)); + execlp(argv[0], argv[0], argv[1], argv[2], argv[3], argv[4], nullptr); + carla_stderr2("exec of UI failed: %s", std::strerror(errno)); return false; - case -1: - carla_stderr2("fork() failed to create new process for plugin UI"); + case -1: /* error */ + carla_stderr2("vfork() failed: %s", std::strerror(errno)); return false; } @@ -447,7 +442,7 @@ private: for (i = 0; i < WAIT_ZOMBIE_TIMEOUT / WAIT_STEP; ++i) { - ret = waitpid(pid, NULL, WNOHANG); + ret = waitpid(pid, nullptr, WNOHANG); if (ret != 0) { diff --git a/source/utils/CarlaRingBuffer.hpp b/source/utils/CarlaRingBuffer.hpp index 61c44129e..f1dc3beb9 100644 --- a/source/utils/CarlaRingBuffer.hpp +++ b/source/utils/CarlaRingBuffer.hpp @@ -28,12 +28,11 @@ // ----------------------------------------------------------------------- // RingBuffer struct -PRE_PACKED_STRUCTURE struct RingBuffer { int32_t head, tail, written; bool invalidateCommit; char buf[RING_BUFFER_SIZE]; -} POST_PACKED_STRUCTURE; +}; // ----------------------------------------------------------------------- // RingBufferControl class diff --git a/source/utils/CarlaShmUtils.hpp b/source/utils/CarlaShmUtils.hpp index 76ab6fcec..b38407af8 100644 --- a/source/utils/CarlaShmUtils.hpp +++ b/source/utils/CarlaShmUtils.hpp @@ -152,7 +152,7 @@ void* carla_shm_map(shm_t& shm, const size_t size) return ptr; #else - if (ftruncate(shm, size) != 0) + if (ftruncate(shm, static_cast(size)) != 0) return nullptr; return mmap(nullptr, size, PROT_READ|PROT_WRITE, MAP_SHARED, shm, 0); diff --git a/source/utils/CarlaThread.hpp b/source/utils/CarlaThread.hpp index 634a3a534..aa0c2e235 100644 --- a/source/utils/CarlaThread.hpp +++ b/source/utils/CarlaThread.hpp @@ -154,8 +154,8 @@ public: } private: + CarlaMutex fLock; // Thread lock const CarlaString fName; // Thread name - volatile CarlaMutex fLock; // Thread lock volatile pthread_t fHandle; // Handle for this thread volatile bool fShouldExit; // true if thread should exit diff --git a/source/utils/CarlaVstUtils.hpp b/source/utils/CarlaVstUtils.hpp index 559447f90..7499fa555 100644 --- a/source/utils/CarlaVstUtils.hpp +++ b/source/utils/CarlaVstUtils.hpp @@ -130,7 +130,7 @@ typedef AEffect* (*VST_Function)(audioMasterCallback); static inline bool vstPluginCanDo(AEffect* const effect, const char* const feature) { - return (effect->dispatcher(effect, effCanDo, 0, 0, (void*)feature, 0.0f) == 1); + return (effect->dispatcher(effect, effCanDo, 0, 0, const_cast(feature), 0.0f) == 1); } // -----------------------------------------------------------------------