diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2012-04-30 15:54:13 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2012-04-30 15:54:13 +0000 |
commit | eaa7cc5a73416c4b8672ccbf8e53c049e7279285 (patch) | |
tree | 6ea2bb241ba27f90464fb3c1c7596d77e61fe6cd /libs/evoral | |
parent | f99dc6d2ab5acd69268f993ea2bb628d70728426 (diff) |
fix up some const-ness issues starting from Evoral::Event::set(), and intersect with removing Mackie..MidiByteArray::bytes() method which made a copy of the data every time we wrote it
git-svn-id: svn://localhost/ardour2/branches/3.0@12124 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/evoral')
-rw-r--r-- | libs/evoral/evoral/Event.hpp | 2 | ||||
-rw-r--r-- | libs/evoral/src/Event.cpp | 8 |
2 files changed, 7 insertions, 3 deletions
diff --git a/libs/evoral/evoral/Event.hpp b/libs/evoral/evoral/Event.hpp index da8036c8f6..5c287fd714 100644 --- a/libs/evoral/evoral/Event.hpp +++ b/libs/evoral/evoral/Event.hpp @@ -60,7 +60,7 @@ struct Event { const Event& operator=(const Event& copy); - void set(uint8_t* buf, uint32_t size, Time t); + void set(const uint8_t* buf, uint32_t size, Time t); inline bool operator==(const Event& other) const { if (_type != other._type) diff --git a/libs/evoral/src/Event.cpp b/libs/evoral/src/Event.cpp index d0e0e8ac3a..e315d811e0 100644 --- a/libs/evoral/src/Event.cpp +++ b/libs/evoral/src/Event.cpp @@ -118,7 +118,7 @@ Event<Timestamp>::operator=(const Event& copy) template<typename Timestamp> void -Event<Timestamp>::set(uint8_t* buf, uint32_t size, Timestamp t) +Event<Timestamp>::set (const uint8_t* buf, uint32_t size, Timestamp t) { if (_owns_buf) { if (_size < size) { @@ -126,7 +126,11 @@ Event<Timestamp>::set(uint8_t* buf, uint32_t size, Timestamp t) } memcpy (_buf, buf, size); } else { - _buf = buf; + /* XXX this is really dangerous given the + const-ness of buf. The API should really + intervene here. + */ + _buf = const_cast<uint8_t*> (buf); } _original_time = t; |