Browse Source

Revert unintented branch merge

tags/1.9.4
falkTX 11 years ago
parent
commit
54f1fcdb14
30 changed files with 126 additions and 246 deletions
  1. +0
    -1
      source/backend/CarlaEngine.hpp
  2. +0
    -4
      source/backend/CarlaHost.h
  3. +1
    -5
      source/backend/CarlaStandalone.cpp
  4. +1
    -2
      source/backend/engine/CarlaEngineData.cpp
  5. +2
    -20
      source/backend/engine/CarlaEngineGraph.cpp
  6. +0
    -8
      source/backend/engine/CarlaEngineGraph.hpp
  7. +6
    -17
      source/backend/engine/CarlaEngineInternal.cpp
  8. +0
    -4
      source/backend/engine/CarlaEngineInternal.hpp
  9. +1
    -8
      source/backend/engine/CarlaEngineOsc.cpp
  10. +5
    -4
      source/backend/engine/CarlaEngineOsc.hpp
  11. +1
    -2
      source/backend/engine/CarlaEngineThread.cpp
  12. +0
    -11
      source/includes/CarlaDefines.h
  13. +8
    -28
      source/modules/lilv/lilv-0.18.0/lilv/lilvmm.hpp
  14. +0
    -2
      source/tests/CarlaUtils1.cpp
  15. +1
    -1
      source/tests/CarlaUtils3.cpp
  16. +0
    -3
      source/utils/CarlaBinaryUtils.hpp
  17. +4
    -11
      source/utils/CarlaJuceUtils.hpp
  18. +1
    -3
      source/utils/CarlaLibCounter.hpp
  19. +1
    -1
      source/utils/CarlaLv2Utils.hpp
  20. +1
    -7
      source/utils/CarlaMutex.hpp
  21. +3
    -6
      source/utils/CarlaPatchbayUtils.hpp
  22. +4
    -12
      source/utils/CarlaPluginUI.cpp
  23. +0
    -2
      source/utils/CarlaPluginUI.hpp
  24. +15
    -15
      source/utils/CarlaRingBuffer.hpp
  25. +1
    -3
      source/utils/CarlaStateUtils.cpp
  26. +27
    -33
      source/utils/CarlaString.hpp
  27. +4
    -1
      source/utils/CarlaStringList.hpp
  28. +5
    -8
      source/utils/CarlaThread.hpp
  29. +31
    -17
      source/utils/LinkedList.hpp
  30. +3
    -7
      source/utils/RtLinkedList.hpp

+ 0
- 1
source/backend/CarlaEngine.hpp View File

@@ -241,7 +241,6 @@ struct EngineOptions {
#ifndef DOXYGEN #ifndef DOXYGEN
EngineOptions() noexcept; EngineOptions() noexcept;
~EngineOptions() noexcept; ~EngineOptions() noexcept;
CARLA_DECLARE_NON_COPY_STRUCT(EngineOptions)
#endif #endif
}; };




+ 0
- 4
source/backend/CarlaHost.h View File

@@ -137,7 +137,6 @@ typedef struct _CarlaPluginInfo {
*/ */
_CarlaPluginInfo() noexcept; _CarlaPluginInfo() noexcept;
~_CarlaPluginInfo() noexcept; ~_CarlaPluginInfo() noexcept;
CARLA_DECLARE_NON_COPY_STRUCT(_CarlaPluginInfo)
#endif #endif


} CarlaPluginInfo; } CarlaPluginInfo;
@@ -213,7 +212,6 @@ typedef struct _CarlaNativePluginInfo {
* C++ constructor. * C++ constructor.
*/ */
_CarlaNativePluginInfo() noexcept; _CarlaNativePluginInfo() noexcept;
CARLA_DECLARE_NON_COPY_STRUCT(_CarlaNativePluginInfo)
#endif #endif


} CarlaNativePluginInfo; } CarlaNativePluginInfo;
@@ -269,7 +267,6 @@ typedef struct _CarlaParameterInfo {
*/ */
_CarlaParameterInfo() noexcept; _CarlaParameterInfo() noexcept;
~_CarlaParameterInfo() noexcept; ~_CarlaParameterInfo() noexcept;
CARLA_DECLARE_NON_COPY_STRUCT(_CarlaParameterInfo)
#endif #endif


} CarlaParameterInfo; } CarlaParameterInfo;
@@ -295,7 +292,6 @@ typedef struct _CarlaScalePointInfo {
*/ */
_CarlaScalePointInfo() noexcept; _CarlaScalePointInfo() noexcept;
~_CarlaScalePointInfo() noexcept; ~_CarlaScalePointInfo() noexcept;
CARLA_DECLARE_NON_COPY_STRUCT(_CarlaScalePointInfo)
#endif #endif


} CarlaScalePointInfo; } CarlaScalePointInfo;


+ 1
- 5
source/backend/CarlaStandalone.cpp View File

@@ -57,10 +57,8 @@ struct CarlaBackendStandalone {
: engine(nullptr), : engine(nullptr),
engineCallback(nullptr), engineCallback(nullptr),
engineCallbackPtr(nullptr), engineCallbackPtr(nullptr),
engineOptions(),
fileCallback(nullptr), fileCallback(nullptr),
fileCallbackPtr(nullptr),
lastError()
fileCallbackPtr(nullptr)
{ {
#ifdef BUILD_BRIDGE #ifdef BUILD_BRIDGE
engineOptions.processMode = CB::ENGINE_PROCESS_MODE_BRIDGE; engineOptions.processMode = CB::ENGINE_PROCESS_MODE_BRIDGE;
@@ -104,8 +102,6 @@ class CarlaNSM
public: public:
CarlaNSM() noexcept CarlaNSM() noexcept
: fOscServer(nullptr), : fOscServer(nullptr),
fClientId(),
fProjectPath(),
fHasBroadcast(false), fHasBroadcast(false),
fHasShowHideUI(false) {} fHasShowHideUI(false) {}




+ 1
- 2
source/backend/engine/CarlaEngineData.cpp View File

@@ -245,8 +245,7 @@ EngineTimeInfo::EngineTimeInfo() noexcept
: playing(false), : playing(false),
frame(0), frame(0),
usecs(0), usecs(0),
valid(0x0),
bbt() {}
valid(0x0) {}


void EngineTimeInfo::clear() noexcept void EngineTimeInfo::clear() noexcept
{ {


+ 2
- 20
source/backend/engine/CarlaEngineGraph.cpp View File

@@ -123,28 +123,10 @@ uint RackGraph::MIDI::getPortId(const bool isInput, const char portName[], bool*
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
// RackGraph // RackGraph


RackGraph::Audio::Audio() noexcept
: mutex(),
connectedIn1(),
connectedIn2(),
connectedOut1(),
connectedOut2(),
inBuf{0, 0},
inBufTmp{0, 0},
outBuf{0, 0} {}

RackGraph::MIDI::MIDI() noexcept
: ins(),
outs() {}

RackGraph::RackGraph(const uint32_t bufferSize, const uint32_t ins, const uint32_t outs) noexcept RackGraph::RackGraph(const uint32_t bufferSize, const uint32_t ins, const uint32_t outs) noexcept
: connections(),
inputs(ins),
: inputs(ins),
outputs(outs), outputs(outs),
isOffline(false),
retCon(),
audio(),
midi()
isOffline(false)
{ {
audio.inBuf[0] = audio.inBuf[1] = nullptr; audio.inBuf[0] = audio.inBuf[1] = nullptr;
audio.inBufTmp[0] = audio.inBufTmp[1] = nullptr; audio.inBufTmp[0] = audio.inBufTmp[1] = nullptr;


+ 0
- 8
source/backend/engine/CarlaEngineGraph.hpp View File

@@ -76,10 +76,6 @@ struct RackGraph {
float* inBuf[2]; float* inBuf[2];
float* inBufTmp[2]; float* inBufTmp[2];
float* outBuf[2]; float* outBuf[2];
// c++ compat stuff
Audio() noexcept;
CARLA_PREVENT_HEAP_ALLOCATION
CARLA_DECLARE_NON_COPY_CLASS(Audio)
} audio; } audio;


struct MIDI { struct MIDI {
@@ -87,10 +83,6 @@ struct RackGraph {
LinkedList<PortNameToId> outs; LinkedList<PortNameToId> outs;
const char* getName(const bool isInput, const uint portId) const noexcept; const char* getName(const bool isInput, const uint portId) const noexcept;
uint getPortId(const bool isInput, const char portName[], bool* const ok = nullptr) const noexcept; uint getPortId(const bool isInput, const char portName[], bool* const ok = nullptr) const noexcept;
MIDI() noexcept;
// c++ compat stuff
CARLA_PREVENT_HEAP_ALLOCATION
CARLA_DECLARE_NON_COPY_CLASS(MIDI)
} midi; } midi;


RackGraph(const uint32_t bufferSize, const uint32_t inputs, const uint32_t outputs) noexcept; RackGraph(const uint32_t bufferSize, const uint32_t inputs, const uint32_t outputs) noexcept;


+ 6
- 17
source/backend/engine/CarlaEngineInternal.cpp View File

@@ -67,8 +67,7 @@ EngineInternalTime::EngineInternalTime() noexcept
EngineNextAction::EngineNextAction() noexcept EngineNextAction::EngineNextAction() noexcept
: opcode(kEnginePostActionNull), : opcode(kEnginePostActionNull),
pluginId(0), pluginId(0),
value(0),
waitEvent() {}
value(0) {}


EngineNextAction::~EngineNextAction() noexcept EngineNextAction::~EngineNextAction() noexcept
{ {
@@ -98,25 +97,15 @@ CarlaEngine::ProtectedData::ProtectedData(CarlaEngine* const engine) noexcept
isIdling(0), isIdling(0),
curPluginCount(0), curPluginCount(0),
maxPluginNumber(0), maxPluginNumber(0),
nextPluginId(0),
lastError(),
name(),
options(),
timeInfo(),
#ifndef BUILD_BRIDGE
plugins(nullptr),
#endif
events(),
#ifndef BUILD_BRIDGE #ifndef BUILD_BRIDGE
graph(),
#endif
time(),
nextAction()
nextPluginId(0),
plugins(nullptr) {}
#else
nextPluginId(0)
{ {
#ifdef BUILD_BRIDGE
carla_zeroStruct(plugins, 1); carla_zeroStruct(plugins, 1);
#endif
} }
#endif


CarlaEngine::ProtectedData::~ProtectedData() noexcept CarlaEngine::ProtectedData::~ProtectedData() noexcept
{ {


+ 0
- 4
source/backend/engine/CarlaEngineInternal.hpp View File

@@ -26,9 +26,6 @@
using juce::Atomic; using juce::Atomic;
using juce::WaitableEvent; using juce::WaitableEvent;


// FIXME only use CARLA_PREVENT_HEAP_ALLOCATION for structs
// maybe separate macro

CARLA_BACKEND_START_NAMESPACE CARLA_BACKEND_START_NAMESPACE


// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
@@ -90,7 +87,6 @@ private:
PatchbayGraph* fPatchbay; PatchbayGraph* fPatchbay;
}; };


CARLA_PREVENT_HEAP_ALLOCATION
CARLA_DECLARE_NON_COPY_STRUCT(EngineInternalGraph) CARLA_DECLARE_NON_COPY_STRUCT(EngineInternalGraph)
}; };
#endif #endif


+ 1
- 8
source/backend/engine/CarlaEngineOsc.cpp View File

@@ -41,15 +41,8 @@ extern int CarlaPluginSetOscBridgeInfo(CarlaPlugin* const plugin, const PluginBr


CarlaEngineOsc::CarlaEngineOsc(CarlaEngine* const engine) noexcept CarlaEngineOsc::CarlaEngineOsc(CarlaEngine* const engine) noexcept
: fEngine(engine), : fEngine(engine),
#ifndef BUILD_BRIDGE
fControlData(),
#endif
fName(),
fServerPathTCP(),
fServerPathUDP(),
fServerTCP(nullptr), fServerTCP(nullptr),
fServerUDP(nullptr),
leakDetector()
fServerUDP(nullptr)
{ {
CARLA_SAFE_ASSERT(engine != nullptr); CARLA_SAFE_ASSERT(engine != nullptr);
carla_debug("CarlaEngineOsc::CarlaEngineOsc(%p)", engine); carla_debug("CarlaEngineOsc::CarlaEngineOsc(%p)", engine);


+ 5
- 4
source/backend/engine/CarlaEngineOsc.hpp View File

@@ -93,16 +93,17 @@ public:
private: private:
CarlaEngine* const fEngine; CarlaEngine* const fEngine;


#ifndef BUILD_BRIDGE
CarlaOscData fControlData; // for carla-control
#endif

CarlaString fName; CarlaString fName;

CarlaString fServerPathTCP; CarlaString fServerPathTCP;
CarlaString fServerPathUDP; CarlaString fServerPathUDP;
lo_server fServerTCP; lo_server fServerTCP;
lo_server fServerUDP; lo_server fServerUDP;


#ifndef BUILD_BRIDGE
CarlaOscData fControlData; // for carla-control
#endif

// ------------------------------------------------------------------- // -------------------------------------------------------------------


int handleMessage(const bool isTCP, const char* const path, const int argc, const lo_arg* const* const argv, const char* const types, const lo_message msg); int handleMessage(const bool isTCP, const char* const path, const int argc, const lo_arg* const* const argv, const char* const types, const lo_message msg);


+ 1
- 2
source/backend/engine/CarlaEngineThread.cpp View File

@@ -25,8 +25,7 @@ CARLA_BACKEND_START_NAMESPACE


CarlaEngineThread::CarlaEngineThread(CarlaEngine* const engine) noexcept CarlaEngineThread::CarlaEngineThread(CarlaEngine* const engine) noexcept
: CarlaThread("CarlaEngineThread"), : CarlaThread("CarlaEngineThread"),
kEngine(engine),
leakDetector()
kEngine(engine)
{ {
CARLA_SAFE_ASSERT(engine != nullptr); CARLA_SAFE_ASSERT(engine != nullptr);
carla_debug("CarlaEngineThread::CarlaEngineThread(%p)", engine); carla_debug("CarlaEngineThread::CarlaEngineThread(%p)", engine);


+ 0
- 11
source/includes/CarlaDefines.h View File

@@ -209,17 +209,6 @@ private: \
static void operator delete(void*); static void operator delete(void*);
#endif #endif


/* Define CARLA_PREVENT_VIRTUAL_HEAP_ALLOCATION */
#ifdef CARLA_PROPER_CPP11_SUPPORT
# define CARLA_PREVENT_VIRTUAL_HEAP_ALLOCATION \
private: \
static void* operator new(size_t) = delete;
#else
# define CARLA_PREVENT_VIRTUAL_HEAP_ALLOCATION \
private: \
static void* operator new(size_t);
#endif

/* Define EXTERN_C */ /* Define EXTERN_C */
#ifdef __cplusplus #ifdef __cplusplus
# define EXTERN_C extern "C" # define EXTERN_C extern "C"


+ 8
- 28
source/modules/lilv/lilv-0.18.0/lilv/lilvmm.hpp View File

@@ -17,8 +17,6 @@
#ifndef LILV_LILVMM_HPP #ifndef LILV_LILVMM_HPP
#define LILV_LILVMM_HPP #define LILV_LILVMM_HPP


#include "CarlaDefines.h"

#include "lilv/lilv.h" #include "lilv/lilv.h"


#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1) #if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1)
@@ -99,12 +97,6 @@ struct Node {
LILV_WRAP0_CONST(bool, node, is_bool); LILV_WRAP0_CONST(bool, node, is_bool);
LILV_WRAP0_CONST(bool, node, as_bool); LILV_WRAP0_CONST(bool, node, as_bool);


Node& operator=(const Node& copy) {
lilv_node_free(me);
me = lilv_node_duplicate(copy.me);
return *this;
}

LilvNode* me; LilvNode* me;
}; };


@@ -116,8 +108,6 @@ struct ScalePoint {
LILV_WRAP0(const LilvNode*, scale_point, get_value); LILV_WRAP0(const LilvNode*, scale_point, get_value);


const LilvScalePoint* me; const LilvScalePoint* me;

//CARLA_DECLARE_NON_COPY_STRUCT(ScalePoint)
}; };


struct PluginClass { struct PluginClass {
@@ -130,8 +120,6 @@ struct PluginClass {
LILV_WRAP0(LilvPluginClasses*, plugin_class, get_children); LILV_WRAP0(LilvPluginClasses*, plugin_class, get_children);


const LilvPluginClass* me; const LilvPluginClass* me;

//CARLA_DECLARE_NON_COPY_STRUCT(PluginClass)
}; };


#define LILV_WRAP_COLL(CT, ET, prefix) \ #define LILV_WRAP_COLL(CT, ET, prefix) \
@@ -177,8 +165,6 @@ struct UI {
LILV_WRAP0(Nodes, ui, get_extension_data); LILV_WRAP0(Nodes, ui, get_extension_data);


const LilvUI* me; const LilvUI* me;

//CARLA_DECLARE_NON_COPY_STRUCT(UI)
}; };


struct UIs { struct UIs {
@@ -212,8 +198,6 @@ struct Port {


const LilvPlugin* parent; const LilvPlugin* parent;
const LilvPort* me; const LilvPort* me;

//CARLA_DECLARE_NON_COPY_STRUCT(Port)
}; };


struct Plugin { struct Plugin {
@@ -270,8 +254,6 @@ struct Plugin {
} }


const LilvPlugin* me; const LilvPlugin* me;

//CARLA_DECLARE_NON_COPY_STRUCT(Plugin)
}; };


struct Plugins { struct Plugins {
@@ -283,13 +265,15 @@ struct Instance {
inline Instance(LilvInstance* instance) : me(instance) {} inline Instance(LilvInstance* instance) : me(instance) {}


LILV_DEPRECATED LILV_DEPRECATED
inline Instance(Plugin plugin, double sample_rate)
: me(lilv_plugin_instantiate(plugin, sample_rate, nullptr)) {}
inline Instance(Plugin plugin, double sample_rate) {
me = lilv_plugin_instantiate(plugin, sample_rate, nullptr);
}


LILV_DEPRECATED inline Instance(Plugin plugin, LILV_DEPRECATED inline Instance(Plugin plugin,
double sample_rate, double sample_rate,
LV2_Feature* const* features)
me(lilv_plugin_instantiate(plugin, sample_rate, features)) {}
LV2_Feature* const* features) {
me = lilv_plugin_instantiate(plugin, sample_rate, features);
}


static inline Instance* create(Plugin plugin, static inline Instance* create(Plugin plugin,
double sample_rate, double sample_rate,
@@ -323,13 +307,11 @@ struct Instance {
} }


LilvInstance* me; LilvInstance* me;

//CARLA_DECLARE_NON_COPY_STRUCT(Instance)
}; };


struct World { struct World {
inline World() : me(lilv_world_new()) {}
inline virtual ~World() { lilv_world_free(me); }
inline World() : me(lilv_world_new()) {}
inline ~World() { lilv_world_free(me); }


inline LilvNode* new_uri(const char* uri) const { inline LilvNode* new_uri(const char* uri) const {
return lilv_new_uri(me, uri); return lilv_new_uri(me, uri);
@@ -361,8 +343,6 @@ struct World {
LILV_WRAP1(int, world, load_resource, const LilvNode*, resource); LILV_WRAP1(int, world, load_resource, const LilvNode*, resource);


LilvWorld* me; LilvWorld* me;

CARLA_DECLARE_NON_COPY_STRUCT(World)
}; };


} /* namespace Lilv */ } /* namespace Lilv */


+ 0
- 2
source/tests/CarlaUtils1.cpp View File

@@ -121,8 +121,6 @@ static void test_CarlaUtils()
str4 = nullptr; str4 = nullptr;
} }
} }

CARLA_DECLARE_NON_COPY_STRUCT(TestStruct)
}; };


TestStruct a, b, c; TestStruct a, b, c;


+ 1
- 1
source/tests/CarlaUtils3.cpp View File

@@ -30,7 +30,7 @@
class LeakTestClass class LeakTestClass
{ {
public: public:
LeakTestClass() noexcept
LeakTestClass()noexcept
: i(0) {} : i(0) {}


private: private:


+ 0
- 3
source/utils/CarlaBinaryUtils.hpp View File

@@ -56,9 +56,6 @@ public:


private: private:
const magic_t fMagic; const magic_t fMagic;

CARLA_PREVENT_HEAP_ALLOCATION
CARLA_DECLARE_NON_COPY_STRUCT(CarlaMagic)
}; };


static const CarlaMagic& getCarlaMagicInstance() static const CarlaMagic& getCarlaMagicInstance()


+ 4
- 11
source/utils/CarlaJuceUtils.hpp View File

@@ -45,21 +45,12 @@
#define CARLA_LEAK_DETECTOR(ClassName) \ #define CARLA_LEAK_DETECTOR(ClassName) \
friend class ::LeakedObjectDetector<ClassName>; \ friend class ::LeakedObjectDetector<ClassName>; \
static const char* getLeakedObjectClassName() noexcept { return #ClassName; } \ static const char* getLeakedObjectClassName() noexcept { return #ClassName; } \
::LeakedObjectDetector<ClassName> leakDetector;

#define CARLA_LEAK_DETECTOR_NAME(ClassName, leakDetectorName) \
friend class ::LeakedObjectDetector<ClassName>; \
static const char* getLeakedObjectClassName() noexcept { return #ClassName; } \
::LeakedObjectDetector<ClassName> leakDetectorName;
::LeakedObjectDetector<ClassName> CARLA_JOIN_MACRO(leakDetector, __LINE__);


#define CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(ClassName) \ #define CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(ClassName) \
CARLA_DECLARE_NON_COPY_CLASS(ClassName) \ CARLA_DECLARE_NON_COPY_CLASS(ClassName) \
CARLA_LEAK_DETECTOR(ClassName) CARLA_LEAK_DETECTOR(ClassName)


#define CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR_NAME(ClassName, leakDetectorName) \
CARLA_DECLARE_NON_COPY_CLASS(ClassName) \
CARLA_LEAK_DETECTOR_NAME(ClassName, leakDetectorName)

//============================================================================== //==============================================================================
/** /**
Embedding an instance of this class inside another class can be used as a low-overhead Embedding an instance of this class inside another class can be used as a low-overhead
@@ -105,7 +96,9 @@ private:
{ {
public: public:
LeakCounter() noexcept LeakCounter() noexcept
: numObjects(0) {}
{
numObjects = 0;
}


~LeakCounter() noexcept ~LeakCounter() noexcept
{ {


+ 1
- 3
source/utils/CarlaLibCounter.hpp View File

@@ -27,9 +27,7 @@
class LibCounter class LibCounter
{ {
public: public:
LibCounter() noexcept
: fMutex(),
fLibs() {}
LibCounter() noexcept {}


~LibCounter() noexcept ~LibCounter() noexcept
{ {


+ 1
- 1
source/utils/CarlaLv2Utils.hpp View File

@@ -429,7 +429,7 @@ public:
return cState; return cState;
} }


CARLA_PREVENT_VIRTUAL_HEAP_ALLOCATION
CARLA_PREVENT_HEAP_ALLOCATION
}; };


// ----------------------------------------------------------------------- // -----------------------------------------------------------------------


+ 1
- 7
source/utils/CarlaMutex.hpp View File

@@ -32,8 +32,7 @@ public:
* Constructor. * Constructor.
*/ */
CarlaMutex() noexcept CarlaMutex() noexcept
: fMutex(),
fTryLockWasCalled(false)
: fTryLockWasCalled(false)
{ {
pthread_mutex_init(&fMutex, nullptr); pthread_mutex_init(&fMutex, nullptr);
} }
@@ -104,11 +103,6 @@ public:
* Constructor. * Constructor.
*/ */
CarlaRecursiveMutex() noexcept CarlaRecursiveMutex() noexcept
#ifdef CARLA_OS_WIN
: fSection()
#else
: fMutex()
#endif
{ {
#ifdef CARLA_OS_WIN #ifdef CARLA_OS_WIN
InitializeCriticalSection(&fSection); InitializeCriticalSection(&fSection);


+ 3
- 6
source/utils/CarlaPatchbayUtils.hpp View File

@@ -66,8 +66,7 @@ struct PatchbayGroupList {
LinkedList<GroupNameToId> list; LinkedList<GroupNameToId> list;


PatchbayGroupList() noexcept PatchbayGroupList() noexcept
: lastId(0),
list() {}
: lastId(0) {}


void clear() noexcept void clear() noexcept
{ {
@@ -160,8 +159,7 @@ struct PatchbayPortList {
LinkedList<PortNameToId> list; LinkedList<PortNameToId> list;


PatchbayPortList() noexcept PatchbayPortList() noexcept
: lastId(0),
list() {}
: lastId(0) {}


void clear() noexcept void clear() noexcept
{ {
@@ -249,8 +247,7 @@ struct PatchbayConnectionList {
LinkedList<ConnectionToId> list; LinkedList<ConnectionToId> list;


PatchbayConnectionList() noexcept PatchbayConnectionList() noexcept
: lastId(0),
list() {}
: lastId(0) {}


void clear() noexcept void clear() noexcept
{ {


+ 4
- 12
source/utils/CarlaPluginUI.cpp View File

@@ -41,10 +41,10 @@ static int temporaryErrorHandler(Display*, XErrorEvent*)
return 0; return 0;
} }


class X11PluginUI : public CarlaPluginUI
class X11PluginUi : public CarlaPluginUI
{ {
public: public:
X11PluginUI(CloseCallback* const cb, const uintptr_t parentId) noexcept
X11PluginUi(CloseCallback* const cb, const uintptr_t parentId) noexcept
: CarlaPluginUI(cb), : CarlaPluginUI(cb),
fDisplay(nullptr), fDisplay(nullptr),
fWindow(0), fWindow(0),
@@ -88,7 +88,7 @@ public:
setTransientWinId(parentId); setTransientWinId(parentId);
} }


~X11PluginUI() override
~X11PluginUi() override
{ {
CARLA_SAFE_ASSERT(! fIsVisible); CARLA_SAFE_ASSERT(! fIsVisible);


@@ -293,8 +293,6 @@ private:
bool fIsVisible; bool fIsVisible;
bool fFirstShow; bool fFirstShow;
EventProcPtr fEventProc; EventProcPtr fEventProc;

CARLA_DECLARE_NON_COPY_CLASS(X11PluginUI)
}; };
#endif #endif


@@ -316,9 +314,6 @@ bool CarlaPluginUI::tryTransientWinIdMatch(const uintptr_t pid, const char* cons
Display* display; Display* display;
ScopedDisplay() : display(XOpenDisplay(nullptr)) {} ScopedDisplay() : display(XOpenDisplay(nullptr)) {}
~ScopedDisplay() { if (display!=nullptr) XCloseDisplay(display); } ~ScopedDisplay() { if (display!=nullptr) XCloseDisplay(display); }
// c++ compat stuff
CARLA_PREVENT_HEAP_ALLOCATION
CARLA_DECLARE_NON_COPY_CLASS(ScopedDisplay)
}; };
struct ScopedFreeData { struct ScopedFreeData {
union { union {
@@ -328,9 +323,6 @@ bool CarlaPluginUI::tryTransientWinIdMatch(const uintptr_t pid, const char* cons
ScopedFreeData(char* d) : data(d) {} ScopedFreeData(char* d) : data(d) {}
ScopedFreeData(uchar* d) : udata(d) {} ScopedFreeData(uchar* d) : udata(d) {}
~ScopedFreeData() { XFree(data); } ~ScopedFreeData() { XFree(data); }
// c++ compat stuff
CARLA_PREVENT_HEAP_ALLOCATION
CARLA_DECLARE_NON_COPY_CLASS(ScopedFreeData)
}; };


const ScopedDisplay sd; const ScopedDisplay sd;
@@ -510,7 +502,7 @@ CarlaPluginUI* CarlaPluginUI::newWindows(CloseCallback*, uintptr_t)
#ifdef HAVE_X11 #ifdef HAVE_X11
CarlaPluginUI* CarlaPluginUI::newX11(CloseCallback* cb, uintptr_t parentId) CarlaPluginUI* CarlaPluginUI::newX11(CloseCallback* cb, uintptr_t parentId)
{ {
return new X11PluginUI(cb, parentId);
return new X11PluginUi(cb, parentId);
} }
#endif #endif




+ 0
- 2
source/utils/CarlaPluginUI.hpp View File

@@ -60,8 +60,6 @@ protected:
bool fIsIdling; bool fIsIdling;
CloseCallback* fCallback; CloseCallback* fCallback;
CarlaPluginUI(CloseCallback* const cb) noexcept : fIsIdling(false), fCallback(cb) {} CarlaPluginUI(CloseCallback* const cb) noexcept : fIsIdling(false), fCallback(cb) {}

CARLA_DECLARE_NON_COPY_CLASS(CarlaPluginUI)
}; };


// ----------------------------------------------------- // -----------------------------------------------------


+ 15
- 15
source/utils/CarlaRingBuffer.hpp View File

@@ -75,9 +75,6 @@ struct BigStackBuffer {
uint8_t buf[size]; uint8_t buf[size];
}; };


#define HeapBuffer_INIT {0, 0, 0, 0, false, nullptr}
#define StackBuffer_INIT {0, 0, 0, false, {0}}

// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
// CarlaRingBuffer templated class // CarlaRingBuffer templated class


@@ -88,9 +85,12 @@ public:
CarlaRingBuffer() noexcept CarlaRingBuffer() noexcept
: fBuffer(nullptr) {} : fBuffer(nullptr) {}


virtual ~CarlaRingBuffer() noexcept {}

// -------------------------------------------------------------------
CarlaRingBuffer(BufferStruct* const ringBuf) noexcept
: fBuffer(ringBuf)
{
if (ringBuf != nullptr)
clear();
}


void clear() noexcept void clear() noexcept
{ {
@@ -376,7 +376,7 @@ protected:
private: private:
BufferStruct* fBuffer; BufferStruct* fBuffer;


CARLA_PREVENT_VIRTUAL_HEAP_ALLOCATION
CARLA_PREVENT_HEAP_ALLOCATION
CARLA_DECLARE_NON_COPY_CLASS(CarlaRingBuffer) CARLA_DECLARE_NON_COPY_CLASS(CarlaRingBuffer)
}; };


@@ -387,9 +387,12 @@ class CarlaHeapRingBuffer : public CarlaRingBuffer<HeapBuffer>
{ {
public: public:
CarlaHeapRingBuffer() noexcept CarlaHeapRingBuffer() noexcept
: fHeapBuffer(HeapBuffer_INIT) {}
: CarlaRingBuffer<HeapBuffer>()
{
carla_zeroStruct(fHeapBuffer);
}


~CarlaHeapRingBuffer() noexcept override
~CarlaHeapRingBuffer() noexcept
{ {
if (fHeapBuffer.buf == nullptr) if (fHeapBuffer.buf == nullptr)
return; return;
@@ -427,7 +430,7 @@ public:
private: private:
HeapBuffer fHeapBuffer; HeapBuffer fHeapBuffer;


CARLA_PREVENT_VIRTUAL_HEAP_ALLOCATION
CARLA_PREVENT_HEAP_ALLOCATION
CARLA_DECLARE_NON_COPY_CLASS(CarlaHeapRingBuffer) CARLA_DECLARE_NON_COPY_CLASS(CarlaHeapRingBuffer)
}; };


@@ -438,15 +441,12 @@ class CarlaStackRingBuffer : public CarlaRingBuffer<StackBuffer>
{ {
public: public:
CarlaStackRingBuffer() noexcept CarlaStackRingBuffer() noexcept
: fStackBuffer(StackBuffer_INIT)
{
setRingBuffer(&fStackBuffer, true); // FIXME
}
: CarlaRingBuffer<StackBuffer>(&fStackBuffer) {}


private: private:
StackBuffer fStackBuffer; StackBuffer fStackBuffer;


CARLA_PREVENT_VIRTUAL_HEAP_ALLOCATION
CARLA_PREVENT_HEAP_ALLOCATION
CARLA_DECLARE_NON_COPY_CLASS(CarlaStackRingBuffer) CARLA_DECLARE_NON_COPY_CLASS(CarlaStackRingBuffer)
}; };




+ 1
- 3
source/utils/CarlaStateUtils.cpp View File

@@ -152,9 +152,7 @@ StateSave::StateSave() noexcept
currentProgramName(nullptr), currentProgramName(nullptr),
currentMidiBank(-1), currentMidiBank(-1),
currentMidiProgram(-1), currentMidiProgram(-1),
chunk(nullptr),
parameters(),
customData() {}
chunk(nullptr) {}


StateSave::~StateSave() noexcept StateSave::~StateSave() noexcept
{ {


+ 27
- 33
source/utils/CarlaString.hpp View File

@@ -40,20 +40,20 @@ public:
* Empty string. * Empty string.
*/ */
explicit CarlaString() noexcept explicit CarlaString() noexcept
: fBuffer(_null()),
fBufferLen(0) {}
{
_init();
}


/* /*
* Simple character. * Simple character.
*/ */
explicit CarlaString(const char c) noexcept explicit CarlaString(const char c) noexcept
: fBuffer(_null()),
fBufferLen(0)
{ {
char ch[2]; char ch[2];
ch[0] = c; ch[0] = c;
ch[1] = '\0'; ch[1] = '\0';


_init();
_dup(ch); _dup(ch);
} }


@@ -61,9 +61,8 @@ public:
* Simple char string. * Simple char string.
*/ */
explicit CarlaString(char* const strBuf) noexcept explicit CarlaString(char* const strBuf) noexcept
: fBuffer(_null()),
fBufferLen(0)
{ {
_init();
_dup(strBuf); _dup(strBuf);
} }


@@ -71,9 +70,8 @@ public:
* Simple const char string. * Simple const char string.
*/ */
explicit CarlaString(const char* const strBuf) noexcept explicit CarlaString(const char* const strBuf) noexcept
: fBuffer(_null()),
fBufferLen(0)
{ {
_init();
_dup(strBuf); _dup(strBuf);
} }


@@ -81,13 +79,12 @@ public:
* Integer. * Integer.
*/ */
explicit CarlaString(const int value) noexcept explicit CarlaString(const int value) noexcept
: fBuffer(_null()),
fBufferLen(0)
{ {
char strBuf[0xff+1]; char strBuf[0xff+1];
std::snprintf(strBuf, 0xff, "%d", value); std::snprintf(strBuf, 0xff, "%d", value);
strBuf[0xff] = '\0'; strBuf[0xff] = '\0';


_init();
_dup(strBuf); _dup(strBuf);
} }


@@ -95,13 +92,12 @@ public:
* Unsigned integer, possibly in hexadecimal. * Unsigned integer, possibly in hexadecimal.
*/ */
explicit CarlaString(const unsigned int value, const bool hexadecimal = false) noexcept explicit CarlaString(const unsigned int value, const bool hexadecimal = false) noexcept
: fBuffer(_null()),
fBufferLen(0)
{ {
char strBuf[0xff+1]; char strBuf[0xff+1];
std::snprintf(strBuf, 0xff, hexadecimal ? "0x%x" : "%u", value); std::snprintf(strBuf, 0xff, hexadecimal ? "0x%x" : "%u", value);
strBuf[0xff] = '\0'; strBuf[0xff] = '\0';


_init();
_dup(strBuf); _dup(strBuf);
} }


@@ -109,13 +105,12 @@ public:
* Long integer. * Long integer.
*/ */
explicit CarlaString(const long value) noexcept explicit CarlaString(const long value) noexcept
: fBuffer(_null()),
fBufferLen(0)
{ {
char strBuf[0xff+1]; char strBuf[0xff+1];
std::snprintf(strBuf, 0xff, "%ld", value); std::snprintf(strBuf, 0xff, "%ld", value);
strBuf[0xff] = '\0'; strBuf[0xff] = '\0';


_init();
_dup(strBuf); _dup(strBuf);
} }


@@ -123,13 +118,12 @@ public:
* Long unsigned integer, possibly hexadecimal. * Long unsigned integer, possibly hexadecimal.
*/ */
explicit CarlaString(const unsigned long value, const bool hexadecimal = false) noexcept explicit CarlaString(const unsigned long value, const bool hexadecimal = false) noexcept
: fBuffer(_null()),
fBufferLen(0)
{ {
char strBuf[0xff+1]; char strBuf[0xff+1];
std::snprintf(strBuf, 0xff, hexadecimal ? "0x%lx" : "%lu", value); std::snprintf(strBuf, 0xff, hexadecimal ? "0x%lx" : "%lu", value);
strBuf[0xff] = '\0'; strBuf[0xff] = '\0';


_init();
_dup(strBuf); _dup(strBuf);
} }


@@ -137,13 +131,12 @@ public:
* Long long integer. * Long long integer.
*/ */
explicit CarlaString(const long long value) noexcept explicit CarlaString(const long long value) noexcept
: fBuffer(_null()),
fBufferLen(0)
{ {
char strBuf[0xff+1]; char strBuf[0xff+1];
std::snprintf(strBuf, 0xff, "%lld", value); std::snprintf(strBuf, 0xff, "%lld", value);
strBuf[0xff] = '\0'; strBuf[0xff] = '\0';


_init();
_dup(strBuf); _dup(strBuf);
} }


@@ -151,13 +144,12 @@ public:
* Long long unsigned integer, possibly hexadecimal. * Long long unsigned integer, possibly hexadecimal.
*/ */
explicit CarlaString(const unsigned long long value, const bool hexadecimal = false) noexcept explicit CarlaString(const unsigned long long value, const bool hexadecimal = false) noexcept
: fBuffer(_null()),
fBufferLen(0)
{ {
char strBuf[0xff+1]; char strBuf[0xff+1];
std::snprintf(strBuf, 0xff, hexadecimal ? "0x%llx" : "%llu", value); std::snprintf(strBuf, 0xff, hexadecimal ? "0x%llx" : "%llu", value);
strBuf[0xff] = '\0'; strBuf[0xff] = '\0';


_init();
_dup(strBuf); _dup(strBuf);
} }


@@ -165,13 +157,12 @@ public:
* Single-precision floating point number. * Single-precision floating point number.
*/ */
explicit CarlaString(const float value) noexcept explicit CarlaString(const float value) noexcept
: fBuffer(_null()),
fBufferLen(0)
{ {
char strBuf[0xff+1]; char strBuf[0xff+1];
std::snprintf(strBuf, 0xff, "%f", value); std::snprintf(strBuf, 0xff, "%f", value);
strBuf[0xff] = '\0'; strBuf[0xff] = '\0';


_init();
_dup(strBuf); _dup(strBuf);
} }


@@ -179,13 +170,12 @@ public:
* Double-precision floating point number. * Double-precision floating point number.
*/ */
explicit CarlaString(const double value) noexcept explicit CarlaString(const double value) noexcept
: fBuffer(_null()),
fBufferLen(0)
{ {
char strBuf[0xff+1]; char strBuf[0xff+1];
std::snprintf(strBuf, 0xff, "%g", value); std::snprintf(strBuf, 0xff, "%g", value);
strBuf[0xff] = '\0'; strBuf[0xff] = '\0';


_init();
_dup(strBuf); _dup(strBuf);
} }


@@ -196,9 +186,8 @@ public:
* Create string from another string. * Create string from another string.
*/ */
CarlaString(const CarlaString& str) noexcept CarlaString(const CarlaString& str) noexcept
: fBuffer(_null()),
fBufferLen(0)
{ {
_init();
_dup(str.fBuffer); _dup(str.fBuffer);
} }


@@ -761,6 +750,16 @@ private:
return &sNull; return &sNull;
} }


/*
* Shared init function.
* Called on all constructors.
*/
void _init() noexcept
{
fBuffer = _null();
fBufferLen = 0;
}

/* /*
* Helper function. * Helper function.
* Called whenever the string needs to be allocated. * Called whenever the string needs to be allocated.
@@ -784,11 +783,7 @@ private:
fBuffer = (char*)std::malloc(fBufferLen+1); fBuffer = (char*)std::malloc(fBufferLen+1);


if (fBuffer == nullptr) if (fBuffer == nullptr)
{
fBuffer = _null();
fBufferLen = 0;
return;
}
return _init();


std::strcpy(fBuffer, strBuf); std::strcpy(fBuffer, strBuf);


@@ -805,8 +800,7 @@ private:
CARLA_SAFE_ASSERT(fBuffer != nullptr); CARLA_SAFE_ASSERT(fBuffer != nullptr);
std::free(fBuffer); std::free(fBuffer);


fBuffer = _null();
fBufferLen = 0;
_init();
} }
} }




+ 4
- 1
source/utils/CarlaStringList.hpp View File

@@ -163,12 +163,14 @@ public:
CarlaStringList() noexcept CarlaStringList() noexcept
: LinkedList<CarlaString>(true) {} : LinkedList<CarlaString>(true) {}


#if 0
CarlaStringList(const CarlaStringList& list) noexcept CarlaStringList(const CarlaStringList& list) noexcept
: LinkedList<CarlaString>(true) : LinkedList<CarlaString>(true)
{ {
for (Itenerator it = list.begin(); it.valid(); it.next()) for (Itenerator it = list.begin(); it.valid(); it.next())
LinkedList<CarlaString>::append(it.getValue()); LinkedList<CarlaString>::append(it.getValue());
} }
#endif


~CarlaStringList() noexcept ~CarlaStringList() noexcept
{ {
@@ -224,7 +226,8 @@ public:
return *this; return *this;
} }


CARLA_PREVENT_VIRTUAL_HEAP_ALLOCATION
private:
LinkedList<CarlaString> fList;
}; };


// ----------------------------------------------------------------------- // -----------------------------------------------------------------------


+ 5
- 8
source/utils/CarlaThread.hpp View File

@@ -37,14 +37,11 @@ protected:
* Constructor. * Constructor.
*/ */
CarlaThread(const char* const threadName = nullptr) noexcept CarlaThread(const char* const threadName = nullptr) noexcept
: fLock(),
fName(threadName),
#ifdef PTW32_DLLPORT
fHandle(nullptr, 0)
#else
fHandle(0),
#endif
fShouldExit(false) {}
: fName(threadName),
fShouldExit(false)
{
_init();
}


/* /*
* Destructor. * Destructor.


+ 31
- 17
source/utils/LinkedList.hpp View File

@@ -47,6 +47,22 @@
((const type *)((const char *)(ptr)-offsetof(type, member))) ((const type *)((const char *)(ptr)-offsetof(type, member)))
#endif #endif


// -----------------------------------------------------------------------
// Declare non copyable and prevent heap allocation

#ifdef CARLA_PROPER_CPP11_SUPPORT
# define LINKED_LIST_DECLARATIONS(ClassName) \
ClassName(ClassName&) = delete; \
ClassName(const ClassName&) = delete; \
ClassName& operator=(const ClassName&) = delete; \
static void* operator new(size_t) = delete;
#else
# define LINKED_LIST_DECLARATIONS(ClassName) \
ClassName(ClassName&); \
ClassName(const ClassName&); \
ClassName& operator=(const ClassName&);
#endif

// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
// Abstract Linked List class // Abstract Linked List class
// _allocate() and _deallocate are virtual calls provided by subclasses // _allocate() and _deallocate are virtual calls provided by subclasses
@@ -69,9 +85,10 @@ protected:


AbstractLinkedList(const bool isClass) noexcept AbstractLinkedList(const bool isClass) noexcept
: kIsClass(isClass), : kIsClass(isClass),
kDataSize(sizeof(Data)),
fCount(0),
fQueue({&fQueue, &fQueue}) {}
kDataSize(sizeof(Data))
{
_init();
}


public: public:
virtual ~AbstractLinkedList() noexcept virtual ~AbstractLinkedList() noexcept
@@ -367,10 +384,9 @@ private:
void _createData(Data* const data, const T& value) noexcept void _createData(Data* const data, const T& value) noexcept
{ {
if (kIsClass) if (kIsClass)
new(data)Data({value, {nullptr, nullptr}});
else
data->value = value;
new(data)Data();


data->value = value;
++fCount; ++fCount;
} }


@@ -381,9 +397,9 @@ private:
_createData(data, value); _createData(data, value);


if (inTail) if (inTail)
__list_add(data->siblings, queue->prev, queue);
__list_add(&data->siblings, queue->prev, queue);
else else
__list_add(data->siblings, queue, queue->next);
__list_add(&data->siblings, queue, queue->next);


return true; return true;
} }
@@ -438,12 +454,12 @@ private:
/* /*
* Insert a new entry between two known consecutive entries. * Insert a new entry between two known consecutive entries.
*/ */
static void __list_add(ListHead& new_, ListHead* const prev, ListHead* const next) noexcept
static void __list_add(ListHead* const new_, ListHead* const prev, ListHead* const next) noexcept
{ {
next->prev = &new_;
new_.next = next;
new_.prev = prev;
prev->next = &new_;
next->prev = new_;
new_->next = next;
new_->prev = prev;
prev->next = new_;
} }


/* /*
@@ -484,8 +500,7 @@ private:


template<typename> friend class RtLinkedList; template<typename> friend class RtLinkedList;


CARLA_PREVENT_VIRTUAL_HEAP_ALLOCATION
CARLA_DECLARE_NON_COPY_CLASS(AbstractLinkedList)
LINKED_LIST_DECLARATIONS(AbstractLinkedList)
}; };


// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
@@ -511,8 +526,7 @@ protected:
std::free(dataPtr); std::free(dataPtr);
} }


CARLA_PREVENT_VIRTUAL_HEAP_ALLOCATION
CARLA_DECLARE_NON_COPY_CLASS(LinkedList)
LINKED_LIST_DECLARATIONS(LinkedList)
}; };


// ----------------------------------------------------------------------- // -----------------------------------------------------------------------


+ 3
- 7
source/utils/RtLinkedList.hpp View File

@@ -93,9 +93,6 @@ public:
private: private:
mutable RtMemPool_Handle fHandle; mutable RtMemPool_Handle fHandle;
const size_t kDataSize; const size_t kDataSize;

CARLA_PREVENT_HEAP_ALLOCATION
CARLA_DECLARE_NON_COPY_CLASS(Pool)
}; };


// ------------------------------------------------------------------- // -------------------------------------------------------------------
@@ -164,9 +161,9 @@ private:
this->_createData(data, value); this->_createData(data, value);


if (inTail) if (inTail)
this->__list_add(data->siblings, this->fQueue.prev, &(this->fQueue));
this->__list_add(&data->siblings, this->fQueue.prev, &this->fQueue);
else else
this->__list_add(data->siblings, &(this->fQueue), this->fQueue.next);
this->__list_add(&data->siblings, &this->fQueue, this->fQueue.next);


return true; return true;
} }
@@ -174,8 +171,7 @@ private:
return false; return false;
} }


CARLA_PREVENT_VIRTUAL_HEAP_ALLOCATION
CARLA_DECLARE_NON_COPY_CLASS(RtLinkedList)
LINKED_LIST_DECLARATIONS(RtLinkedList)
}; };


// ----------------------------------------------------------------------- // -----------------------------------------------------------------------


Loading…
Cancel
Save