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.
This commit is contained in:
David Robillard 2016-12-04 13:20:15 -05:00
parent 11464bfb18
commit 7d2ed46b63
6 changed files with 2 additions and 51 deletions

View File

@ -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

View File

@ -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);
}

View File

@ -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;
}

View File

@ -18,8 +18,6 @@
#include <iostream>
#include "pbd/stacktrace.h"
#include "evoral/Control.hpp"
#include "evoral/ControlList.hpp"
#include "evoral/ParameterDescriptor.hpp"

View File

@ -328,18 +328,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)
{
@ -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);
}
}

View File

@ -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