From 391dd35265d03f3d4ebfcc2e2da28e2db6c75306 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Tue, 17 Dec 2013 03:08:46 +0000 Subject: Make lv2_atom_*_is_end() arguments const. --- lv2/lv2plug.in/ns/ext/atom/forge.h | 2 +- lv2/lv2plug.in/ns/ext/atom/lv2-atom.doap.ttl | 9 +++++++++ lv2/lv2plug.in/ns/ext/atom/util.h | 24 ++++++++++++------------ 3 files changed, 22 insertions(+), 13 deletions(-) diff --git a/lv2/lv2plug.in/ns/ext/atom/forge.h b/lv2/lv2plug.in/ns/ext/atom/forge.h index c825806..683eed8 100644 --- a/lv2/lv2plug.in/ns/ext/atom/forge.h +++ b/lv2/lv2plug.in/ns/ext/atom/forge.h @@ -319,7 +319,7 @@ static inline LV2_Atom_Forge_Ref lv2_atom_forge_primitive(LV2_Atom_Forge* forge, const LV2_Atom* a) { if (lv2_atom_forge_top_is(forge, forge->Vector)) { - return lv2_atom_forge_raw(forge, LV2_ATOM_BODY(a), a->size); + return lv2_atom_forge_raw(forge, LV2_ATOM_BODY_CONST(a), a->size); } else { return lv2_atom_forge_write(forge, a, sizeof(LV2_Atom) + a->size); } diff --git a/lv2/lv2plug.in/ns/ext/atom/lv2-atom.doap.ttl b/lv2/lv2plug.in/ns/ext/atom/lv2-atom.doap.ttl index 71b7d95..64abbfb 100644 --- a/lv2/lv2plug.in/ns/ext/atom/lv2-atom.doap.ttl +++ b/lv2/lv2plug.in/ns/ext/atom/lv2-atom.doap.ttl @@ -12,6 +12,15 @@ doap:created "2007-00-00" ; doap:developer ; doap:release [ + doap:revision "1.7" ; + doap:created "2013-12-16" ; + dcs:blame ; + dcs:changeset [ + dcs:item [ + rdfs:label "Make lv2_atom_*_is_end() arguments const." + ] + ] + ] , [ doap:revision "1.6" ; doap:created "2013-05-26" ; doap:file-release ; diff --git a/lv2/lv2plug.in/ns/ext/atom/util.h b/lv2/lv2plug.in/ns/ext/atom/util.h index 79e3cd8..d15091c 100644 --- a/lv2/lv2plug.in/ns/ext/atom/util.h +++ b/lv2/lv2plug.in/ns/ext/atom/util.h @@ -83,16 +83,16 @@ lv2_atom_sequence_begin(const LV2_Atom_Sequence_Body* body) static inline LV2_Atom_Event* lv2_atom_sequence_end(const LV2_Atom_Sequence_Body* body, uint32_t size) { - return (LV2_Atom_Event*)((uint8_t*)body + lv2_atom_pad_size(size)); + return (LV2_Atom_Event*)((const uint8_t*)body + lv2_atom_pad_size(size)); } /** Return true iff @p i has reached the end of @p body. */ static inline bool lv2_atom_sequence_is_end(const LV2_Atom_Sequence_Body* body, uint32_t size, - LV2_Atom_Event* i) + const LV2_Atom_Event* i) { - return (uint8_t*)i >= ((const uint8_t*)body + size); + return (const uint8_t*)i >= ((const uint8_t*)body + size); } /** Return an iterator to the element following @p i. */ @@ -142,9 +142,9 @@ lv2_atom_tuple_begin(const LV2_Atom_Tuple* tup) /** Return true iff @p i has reached the end of @p body. */ static inline bool -lv2_atom_tuple_is_end(const void* body, uint32_t size, LV2_Atom* i) +lv2_atom_tuple_is_end(const void* body, uint32_t size, const LV2_Atom* i) { - return (uint8_t*)i >= ((const uint8_t*)body + size); + return (const uint8_t*)i >= ((const uint8_t*)body + size); } /** Return an iterator to the element following @p i. */ @@ -152,7 +152,7 @@ static inline LV2_Atom* lv2_atom_tuple_next(const LV2_Atom* i) { return (LV2_Atom*)( - (uint8_t*)i + sizeof(LV2_Atom) + lv2_atom_pad_size(i->size)); + (const uint8_t*)i + sizeof(LV2_Atom) + lv2_atom_pad_size(i->size)); } /** @@ -193,19 +193,19 @@ lv2_atom_object_begin(const LV2_Atom_Object_Body* body) /** Return true iff @p i has reached the end of @p obj. */ static inline bool -lv2_atom_object_is_end(const LV2_Atom_Object_Body* body, - uint32_t size, - LV2_Atom_Property_Body* i) +lv2_atom_object_is_end(const LV2_Atom_Object_Body* body, + uint32_t size, + const LV2_Atom_Property_Body* i) { - return (uint8_t*)i >= ((const uint8_t*)body + size); + return (const uint8_t*)i >= ((const uint8_t*)body + size); } /** Return an iterator to the property following @p i. */ static inline LV2_Atom_Property_Body* lv2_atom_object_next(const LV2_Atom_Property_Body* i) { - const LV2_Atom* const value = (LV2_Atom*)( - (uint8_t*)i + 2 * sizeof(uint32_t)); + const LV2_Atom* const value = (const LV2_Atom*)( + (const uint8_t*)i + 2 * sizeof(uint32_t)); return (LV2_Atom_Property_Body*)( (const uint8_t*)i + lv2_atom_pad_size(sizeof(LV2_Atom_Property_Body) + value->size)); -- cgit v1.2.1