aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2012-03-08 18:31:35 +0000
committerDavid Robillard <d@drobilla.net>2012-03-08 18:31:35 +0000
commit4f01de8d0614017898021a4cf80ff8d4db4cb7de (patch)
tree3ed60b836801b2143221dc862407f59eeaed1f80 /src
parentc024819b9d8c452e970a8702e61c31bd8b319f38 (diff)
downloadjalv-4f01de8d0614017898021a4cf80ff8d4db4cb7de.tar.gz
jalv-4f01de8d0614017898021a4cf80ff8d4db4cb7de.tar.bz2
jalv-4f01de8d0614017898021a4cf80ff8d4db4cb7de.zip
Fix sequence ports.
git-svn-id: http://svn.drobilla.net/lad/trunk/jalv@4034 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src')
-rw-r--r--src/jalv.c16
-rw-r--r--src/lv2_evbuf.c9
2 files changed, 17 insertions, 8 deletions
diff --git a/src/jalv.c b/src/jalv.c
index bb0b653..8deea96 100644
--- a/src/jalv.c
+++ b/src/jalv.c
@@ -424,7 +424,10 @@ jack_process_cb(jack_nframes_t nframes, void* data)
for (size_t i = 0; i < space; i += sizeof(ev) + ev.size) {
jack_ringbuffer_read(host->ui_events, (char*)&ev, sizeof(ev));
char body[ev.size];
- jack_ringbuffer_read(host->ui_events, body, ev.size);
+ if (jack_ringbuffer_read(host->ui_events, body, ev.size) != ev.size) {
+ fprintf(stderr, "error: Error reading from UI ring buffer\n");
+ break;
+ }
struct Port* const port = &host->ports[ev.index];
if (ev.protocol == 0) {
assert(ev.size == sizeof(float));
@@ -468,6 +471,7 @@ jack_process_cb(jack_nframes_t nframes, void* data)
uint8_t* data;
lv2_evbuf_get(i, &frames, &subframes,
&type, &size, &data);
+ assert(size > 0);
// FIXME: check type
jack_midi_event_write(buf, frames, data, size);
@@ -551,10 +555,12 @@ jalv_ui_write(SuilController controller,
}
if (protocol == host->urids.atom_eventTransfer) {
- SerdNode s = serd_node_from_string(SERD_BLANK, USTR("msg"));
- SerdNode p = serd_node_from_string(SERD_URI, USTR(NS_RDF "value"));
- char* str = atom_to_turtle(&host->unmap, &s, &p, (LV2_Atom*)buffer);
- printf("\n## UI => Plugin ##\n%s\n", str);
+ SerdNode s = serd_node_from_string(SERD_BLANK, USTR("msg"));
+ SerdNode p = serd_node_from_string(SERD_URI, USTR(NS_RDF "value"));
+
+ const LV2_Atom* atom = (const LV2_Atom*)buffer;
+ char* str = atom_to_turtle(&host->unmap, &s, &p, atom);
+ printf("\n## UI => Plugin (%u bytes) ##\n%s\n", atom->size, str);
free(str);
}
diff --git a/src/lv2_evbuf.c b/src/lv2_evbuf.c
index f3aea8d..3037e82 100644
--- a/src/lv2_evbuf.c
+++ b/src/lv2_evbuf.c
@@ -14,6 +14,7 @@
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
+#include <assert.h>
#include <string.h>
#include <stdlib.h>
@@ -89,7 +90,7 @@ lv2_evbuf_reset(LV2_Evbuf* evbuf, bool input)
break;
case LV2_EVBUF_ATOM:
if (input) {
- evbuf->buf.atom.atom.size = 0;
+ evbuf->buf.atom.atom.size = sizeof(LV2_Atom_Sequence_Body);
evbuf->buf.atom.atom.type = evbuf->atom_Sequence;
} else {
evbuf->buf.atom.atom.size = evbuf->capacity;
@@ -105,8 +106,10 @@ lv2_evbuf_get_size(LV2_Evbuf* evbuf)
case LV2_EVBUF_EVENT:
return evbuf->buf.event.size;
case LV2_EVBUF_ATOM:
+ assert(evbuf->buf.atom.atom.type != evbuf->atom_Sequence
+ || evbuf->buf.atom.atom.size >= sizeof(LV2_Atom_Sequence_Body));
return evbuf->buf.atom.atom.type == evbuf->atom_Sequence
- ? evbuf->buf.atom.atom.size
+ ? evbuf->buf.atom.atom.size - sizeof(LV2_Atom_Sequence_Body)
: 0;
}
return 0;
@@ -134,7 +137,7 @@ lv2_evbuf_begin(LV2_Evbuf* evbuf)
LV2_Evbuf_Iterator
lv2_evbuf_end(LV2_Evbuf* evbuf)
{
- const size_t size = lv2_evbuf_get_size(evbuf);
+ const uint32_t size = lv2_evbuf_get_size(evbuf);
const LV2_Evbuf_Iterator iter = { evbuf, lv2_evbuf_pad_size(size) };
return iter;
}