diff options
author | David Robillard <d@drobilla.net> | 2016-12-04 13:20:15 -0500 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2016-12-04 15:10:05 -0500 |
commit | 7d2ed46b63821cc9d9bdd5d2366eaaf00726d3fc (patch) | |
tree | 4d6213a2b5d8cab19427117386c9ef169706d75e | |
parent | 11464bfb183b56ec3aafae9c173e78a352929bd9 (diff) |
Remove dead/annoying/unsafe code
Note the old Note::operator= was unsafe, since it made shallow copies of the on
and off events, which results in a double delete of events when the notes are
destructed.
-rw-r--r-- | libs/evoral/evoral/Curve.hpp | 5 | ||||
-rw-r--r-- | libs/evoral/evoral/Note.hpp | 4 | ||||
-rw-r--r-- | libs/evoral/evoral/Range.hpp | 2 | ||||
-rw-r--r-- | libs/evoral/src/Control.cpp | 2 | ||||
-rw-r--r-- | libs/evoral/src/Curve.cpp | 22 | ||||
-rw-r--r-- | libs/evoral/src/Note.cpp | 18 |
6 files changed, 2 insertions, 51 deletions
diff --git a/libs/evoral/evoral/Curve.hpp b/libs/evoral/evoral/Curve.hpp index 6aeeb039d7..bf2de520a0 100644 --- a/libs/evoral/evoral/Curve.hpp +++ b/libs/evoral/evoral/Curve.hpp @@ -41,7 +41,6 @@ public: void mark_dirty() const { _dirty = true; } private: - double unlocked_eval (double where); double multipoint_eval (double x); void _get_vector (double x0, double x1, float *arg, int32_t veclen); @@ -52,9 +51,5 @@ private: } // namespace Evoral -extern "C" { - LIBEVORAL_API void curve_get_vector_from_c (void *arg, double, double, float*, int32_t); -} - #endif // EVORAL_CURVE_HPP diff --git a/libs/evoral/evoral/Note.hpp b/libs/evoral/evoral/Note.hpp index 43db728b0c..88d4077af9 100644 --- a/libs/evoral/evoral/Note.hpp +++ b/libs/evoral/evoral/Note.hpp @@ -43,8 +43,6 @@ public: Note(const Note<Time>& copy); ~Note(); - const Note<Time>& operator=(const Note<Time>& copy); - inline bool operator==(const Note<Time>& other) { return time() == other.time() && note() == other.note() && @@ -69,6 +67,8 @@ public: } private: + const Note<Time>& operator=(const Note<Time>& copy); // undefined (unsafe) + inline int clamp(int val, int low, int high) { return std::min (std::max (val, low), high); } diff --git a/libs/evoral/evoral/Range.hpp b/libs/evoral/evoral/Range.hpp index e2ac87e909..20020115ac 100644 --- a/libs/evoral/evoral/Range.hpp +++ b/libs/evoral/evoral/Range.hpp @@ -78,13 +78,11 @@ template<typename T> if (sa > ea) { // seems we are sometimes called with negative length ranges - std::cerr << "a - start after end: " << sa << ", " << ea << std::endl; return OverlapNone; } if (sb > eb) { // seems we are sometimes called with negative length ranges - std::cerr << "b - start after end: " << sb << ", " << eb << std::endl; return OverlapNone; } diff --git a/libs/evoral/src/Control.cpp b/libs/evoral/src/Control.cpp index a6cd374c54..56f5f70f2c 100644 --- a/libs/evoral/src/Control.cpp +++ b/libs/evoral/src/Control.cpp @@ -18,8 +18,6 @@ #include <iostream> -#include "pbd/stacktrace.h" - #include "evoral/Control.hpp" #include "evoral/ControlList.hpp" #include "evoral/ParameterDescriptor.hpp" diff --git a/libs/evoral/src/Curve.cpp b/libs/evoral/src/Curve.cpp index 8a4aa470c1..a8605c6f1d 100644 --- a/libs/evoral/src/Curve.cpp +++ b/libs/evoral/src/Curve.cpp @@ -329,18 +329,6 @@ Curve::_get_vector (double x0, double x1, float *vec, int32_t veclen) } double -Curve::unlocked_eval (double x) -{ - // I don't see the point of this... - - if (_dirty) { - solve (); - } - - return _list.unlocked_eval (x); -} - -double Curve::multipoint_eval (double x) { pair<ControlList::EventList::const_iterator,ControlList::EventList::const_iterator> range; @@ -416,13 +404,3 @@ Curve::multipoint_eval (double x) } } // namespace Evoral - -extern "C" { - -void -curve_get_vector_from_c (void *arg, double x0, double x1, float* vec, int32_t vecsize) -{ - static_cast<Evoral::Curve*>(arg)->get_vector (x0, x1, vec, vecsize); -} - -} diff --git a/libs/evoral/src/Note.cpp b/libs/evoral/src/Note.cpp index 52a4d6335b..f2d369d825 100644 --- a/libs/evoral/src/Note.cpp +++ b/libs/evoral/src/Note.cpp @@ -92,24 +92,6 @@ Note<Time>::set_id (event_id_t id) _off_event.set_id (id); } -template<typename Time> -const Note<Time>& -Note<Time>::operator=(const Note<Time>& other) -{ - _on_event = other._on_event; - _off_event = other._off_event; - - assert(time() == other.time()); - assert(end_time() == other.end_time()); - assert(length() == other.length()); - assert(note() == other.note()); - assert(velocity() == other.velocity()); - assert(_on_event.channel() == _off_event.channel()); - assert(channel() == other.channel()); - - return *this; -} - template class Note<Evoral::Beats>; } // namespace Evoral |