| @@ -192,10 +192,12 @@ struct Lv2EventData { | |||
| if (midi != nullptr) | |||
| { | |||
| if (midi->data != nullptr) | |||
| { | |||
| delete[] midi->data; | |||
| delete midi; | |||
| midi->data = nullptr; | |||
| } | |||
| midi->data = nullptr; | |||
| delete midi; | |||
| midi = nullptr; | |||
| } | |||
| } | |||
| @@ -2113,8 +2113,10 @@ public: | |||
| lo_server_thread_start(fServerThread); | |||
| } | |||
| #ifndef BUILD_ANSI_TEST | |||
| lo_send_from(addr, lo_server_thread_get_server(fServerThread), LO_TT_IMMEDIATE, "/nsm/server/announce", "sssiii", | |||
| "Carla", ":switch:", appName, NSM_API_VERSION_MAJOR, NSM_API_VERSION_MINOR, pid); | |||
| #endif | |||
| lo_address_free(addr); | |||
| } | |||
| @@ -2184,8 +2186,10 @@ protected: | |||
| for (int i=0; i < 30 && ! fIsOpened; i++) | |||
| carla_msleep(100); | |||
| #ifndef BUILD_ANSI_TEST | |||
| if (fIsOpened) | |||
| lo_send_from(fReplyAddr, lo_server_thread_get_server(fServerThread), LO_TT_IMMEDIATE, "/reply", "ss", "/nsm/client/open", "OK"); | |||
| #endif | |||
| return 0; | |||
| @@ -2214,8 +2218,10 @@ protected: | |||
| for (int i=0; i < 30 && ! fIsSaved; i++) | |||
| carla_msleep(100); | |||
| #ifndef BUILD_ANSI_TEST | |||
| if (fIsSaved) | |||
| lo_send_from(fReplyAddr, lo_server_thread_get_server(fServerThread), LO_TT_IMMEDIATE, "/reply", "ss", "/nsm/client/save", "OK"); | |||
| #endif | |||
| return 0; | |||
| @@ -20,7 +20,7 @@ | |||
| // #include "CarlaPlugin.hpp" | |||
| // #include "CarlaNative.h" | |||
| // #include "CarlaNative.hpp" | |||
| #include "standalone/CarlaStandalone.cpp" | |||
| //#include "standalone/CarlaStandalone.cpp" | |||
| // #include "CarlaMutex.hpp" | |||
| // #include "CarlaString.hpp" | |||
| @@ -18,7 +18,7 @@ BUILD_CXX_FLAGS += -isystem /usr/include/qt4 | |||
| ANSI_CXX_FLAGS = -ansi -pedantic -pedantic-errors -Wunused-parameter -Wuninitialized -Wno-vla | |||
| ANSI_CXX_FLAGS += -Wcast-qual -Wconversion -Wsign-conversion -Wlogical-op -Waggregate-return | |||
| ANSI_CXX_FLAGS += -std=c++11 -Wzero-as-null-pointer-constant | |||
| ANSI_CXX_FLAGS += -DVESTIGE_HEADER -fPIC | |||
| ANSI_CXX_FLAGS += -DBUILD_ANSI_TEST -DVESTIGE_HEADER -fPIC | |||
| TARGETS = ANSI CarlaString RtList Print Utils | |||
| @@ -32,8 +32,8 @@ ANSI: ANSI.cpp | |||
| CarlaString: CarlaString.cpp | |||
| $(CXX) $^ $(BUILD_CXX_FLAGS) $(LINK_FLAGS) -o $@ | |||
| RtList: RtList.cpp ../libs/rtmempool.a | |||
| $(CXX) $^ $(BUILD_CXX_FLAGS) $(LINK_FLAGS) -pthread -lpthread -o $@ | |||
| RtList: RtList.cpp ../libs/rtmempool.a ../utils/RtList.hpp | |||
| $(CXX) RtList.cpp ../libs/rtmempool.a $(BUILD_CXX_FLAGS) $(LINK_FLAGS) -pthread -lpthread -o $@ | |||
| Print: Print.cpp | |||
| $(CXX) $^ $(BUILD_CXX_FLAGS) $(LINK_FLAGS) -o $@ | |||
| @@ -175,5 +175,32 @@ int main() | |||
| assert(postRtEvents.dataPendingRT.count() == 0); | |||
| assert(postRtEvents.dataPendingRT.isEmpty()); | |||
| // test non-rt | |||
| const unsigned int CARLA_EVENT_DATA_ATOM = 0x01; | |||
| const unsigned int CARLA_EVENT_DATA_MIDI_LL = 0x04; | |||
| NonRtList<uint32_t> evIns, evOuts; | |||
| evIns.append(CARLA_EVENT_DATA_ATOM); | |||
| evOuts.append(CARLA_EVENT_DATA_ATOM); | |||
| evOuts.append(CARLA_EVENT_DATA_MIDI_LL); | |||
| if (evIns.count() > 0) | |||
| { | |||
| const size_t count(evIns.count()); | |||
| for (uint32_t j=0; j < count; ++j) | |||
| { | |||
| const uint32_t& type(evIns.getAt(j)); | |||
| if (type == CARLA_EVENT_DATA_ATOM) | |||
| pass(); | |||
| else if (type == CARLA_EVENT_DATA_MIDI_LL) | |||
| pass(); | |||
| } | |||
| } | |||
| evIns.clear(); | |||
| evOuts.clear(); | |||
| return 0; | |||
| } | |||
| @@ -52,21 +52,23 @@ protected: | |||
| Itenerator(k_list_head* queue) | |||
| : kQueue(queue), | |||
| fEntry(queue->next), | |||
| fEntry2(fEntry->next), | |||
| fData(nullptr) | |||
| { | |||
| CARLA_ASSERT(kQueue != nullptr); | |||
| CARLA_ASSERT(fEntry != nullptr); | |||
| CARLA_ASSERT(fEntry2 != nullptr); | |||
| } | |||
| bool valid() | |||
| { | |||
| prefetch(fEntry->next); | |||
| return (fEntry != kQueue); | |||
| } | |||
| void next() | |||
| { | |||
| fEntry = fEntry->next; | |||
| fEntry = fEntry2; | |||
| fEntry2 = fEntry->next; | |||
| } | |||
| T& operator*() | |||
| @@ -79,6 +81,7 @@ protected: | |||
| private: | |||
| k_list_head* const kQueue; | |||
| k_list_head* fEntry; | |||
| k_list_head* fEntry2; | |||
| Data* fData; | |||
| friend class List; | |||
| @@ -107,8 +110,9 @@ public: | |||
| if (fCount != 0) | |||
| { | |||
| k_list_head* entry; | |||
| k_list_head* entry2; | |||
| list_for_each(entry, &fQueue) | |||
| list_for_each_safe(entry, entry2, &fQueue) | |||
| { | |||
| if (Data* data = list_entry(entry, Data, siblings)) | |||
| _deallocate(data); | |||
| @@ -188,8 +192,9 @@ public: | |||
| size_t i = 0; | |||
| Data* data = nullptr; | |||
| k_list_head* entry; | |||
| k_list_head* entry2; | |||
| list_for_each(entry, &fQueue) | |||
| list_for_each_safe(entry, entry2, &fQueue) | |||
| { | |||
| if (index != i++) | |||
| continue; | |||
| @@ -240,8 +245,9 @@ public: | |||
| { | |||
| Data* data = nullptr; | |||
| k_list_head* entry; | |||
| k_list_head* entry2; | |||
| list_for_each(entry, &fQueue) | |||
| list_for_each_safe(entry, entry2, &fQueue) | |||
| { | |||
| data = list_entry(entry, Data, siblings); | |||
| @@ -412,6 +418,8 @@ public: | |||
| void resize(const size_t minPreallocated, const size_t maxPreallocated) | |||
| { | |||
| CARLA_ASSERT(this->fCount == 0); | |||
| if (fHandle != nullptr) | |||
| { | |||
| rtsafe_memory_pool_destroy(fHandle); | |||
| @@ -530,6 +538,7 @@ private: | |||
| void _deallocate(typename List<T>::Data* const dataPtr) override | |||
| { | |||
| CARLA_ASSERT(dataPtr != nullptr); | |||
| std::free(dataPtr); | |||
| } | |||
| @@ -559,6 +568,7 @@ private: | |||
| void _deallocate(typename List<T>::Data* const dataPtr) override | |||
| { | |||
| CARLA_ASSERT(dataPtr != nullptr); | |||
| delete dataPtr; | |||
| } | |||