From 360399998b3dbacd12d8b8a79f2a97e54be6d43f Mon Sep 17 00:00:00 2001 From: David Robillard Date: Mon, 2 Jul 2012 16:21:31 +0000 Subject: Make event iterator gracefully handle optional ports. --- lv2/lv2plug.in/ns/ext/event/event-helpers.h | 5 ++++- lv2/lv2plug.in/ns/ext/event/event.ttl | 9 +++++++++ lv2/lv2plug.in/ns/ext/event/manifest.ttl | 2 +- 3 files changed, 14 insertions(+), 2 deletions(-) (limited to 'lv2/lv2plug.in/ns/ext') diff --git a/lv2/lv2plug.in/ns/ext/event/event-helpers.h b/lv2/lv2plug.in/ns/ext/event/event-helpers.h index 46d634d..8e29507 100644 --- a/lv2/lv2plug.in/ns/ext/event/event-helpers.h +++ b/lv2/lv2plug.in/ns/ext/event/event-helpers.h @@ -108,7 +108,7 @@ lv2_event_begin(LV2_Event_Iterator* iter, static inline bool lv2_event_is_valid(LV2_Event_Iterator* iter) { - return (iter->offset < iter->buf->size); + return (iter->buf && (iter->offset < iter->buf->size)); } @@ -165,6 +165,9 @@ lv2_event_write(LV2_Event_Iterator* iter, uint16_t size, const uint8_t* data) { + if (!iter->buf) + return false; + if (iter->buf->capacity - iter->buf->size < sizeof(LV2_Event) + size) return false; diff --git a/lv2/lv2plug.in/ns/ext/event/event.ttl b/lv2/lv2plug.in/ns/ext/event/event.ttl index e6a11a3..971fce2 100644 --- a/lv2/lv2plug.in/ns/ext/event/event.ttl +++ b/lv2/lv2plug.in/ns/ext/event/event.ttl @@ -17,6 +17,15 @@ , <../../meta/meta.ttl> ; doap:release [ + doap:revision "1.7" ; + doap:created "2012-07-02" ; + dcs:blame ; + dcs:changeset [ + dcs:item [ + rdfs:label "Make event iterator gracefully handle optional ports." + ] + ] + ] , [ doap:revision "1.6" ; doap:created "2012-04-17" ; doap:file-release ; diff --git a/lv2/lv2plug.in/ns/ext/event/manifest.ttl b/lv2/lv2plug.in/ns/ext/event/manifest.ttl index 2b21906..27882bf 100644 --- a/lv2/lv2plug.in/ns/ext/event/manifest.ttl +++ b/lv2/lv2plug.in/ns/ext/event/manifest.ttl @@ -4,6 +4,6 @@ a lv2:Specification ; lv2:minorVersion 1 ; - lv2:microVersion 6 ; + lv2:microVersion 7 ; rdfs:seeAlso . -- cgit v1.2.1