From 2a931ba3f49217dd1041fef9587421495041e6ce Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sat, 3 Mar 2012 21:07:45 +0000 Subject: Fix lv2_atom_forge_bool(). Use pointers for references when using an internal buffer rather than offsets, so 0 isn't a valid reference. --- lv2/lv2plug.in/ns/ext/atom/atom.ttl | 7 ++++--- lv2/lv2plug.in/ns/ext/atom/forge.h | 6 +++--- 2 files changed, 7 insertions(+), 6 deletions(-) (limited to 'lv2') diff --git a/lv2/lv2plug.in/ns/ext/atom/atom.ttl b/lv2/lv2plug.in/ns/ext/atom/atom.ttl index 1b2ed1d..4d7c98e 100644 --- a/lv2/lv2plug.in/ns/ext/atom/atom.ttl +++ b/lv2/lv2plug.in/ns/ext/atom/atom.ttl @@ -237,9 +237,10 @@ atom:URI rdfs:label "URI string" ; lv2:documentation """

A URI string. This is identical in format to atom:String, except the string -is a URI. This is useful when a URI is needed but mapping is inappropriate. -Since the ability to distinguish URIs from plain strings is often necessary, -URIs MUST NOT be transmitted as atom:String.

+is a URI. This is useful when a URI is needed but mapping is inappropriate, +for example with temporary or relative URIs. Since the ability to distinguish +URIs from plain strings is often necessary, URIs MUST NOT be transmitted as +atom:String.

This is not strictly a URI, since UTF-8 is allowed. Escaping and related issues issues are the host's responsibility.

diff --git a/lv2/lv2plug.in/ns/ext/atom/forge.h b/lv2/lv2plug.in/ns/ext/atom/forge.h index c1b6d31..82e80eb 100644 --- a/lv2/lv2plug.in/ns/ext/atom/forge.h +++ b/lv2/lv2plug.in/ns/ext/atom/forge.h @@ -201,7 +201,7 @@ static inline LV2_Atom* lv2_atom_forge_deref(LV2_Atom_Forge* forge, LV2_Atom_Forge_Ref ref) { if (forge->buf) { - return (LV2_Atom*)(forge->buf + ref); + return (LV2_Atom*)ref; } else { return forge->deref(forge->handle, ref); } @@ -219,7 +219,7 @@ lv2_atom_forge_raw(LV2_Atom_Forge* forge, const void* data, uint32_t size) if (forge->sink) { out = forge->sink(forge->handle, data, size); } else { - out = forge->offset; + out = (LV2_Atom_Forge_Ref)forge->buf + forge->offset; uint8_t* mem = forge->buf + forge->offset; if (forge->offset + size > forge->size) { return 0; @@ -316,7 +316,7 @@ lv2_atom_forge_double(LV2_Atom_Forge* forge, double val) static inline LV2_Atom_Forge_Ref lv2_atom_forge_bool(LV2_Atom_Forge* forge, bool val) { - const LV2_Atom_Bool a = { { sizeof(val), forge->Bool }, val }; + const LV2_Atom_Bool a = { { sizeof(int32_t), forge->Bool }, val ? 1 : 0 }; return lv2_atom_forge_primitive(forge, &a.atom); } -- cgit v1.2.1