aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2024-07-16 22:05:36 -0400
committerDavid Robillard <d@drobilla.net>2024-07-16 22:05:36 -0400
commit70e5ebad012d13ff3443b0a5f7fb402ee3212fcb (patch)
tree2281281c20807314d08c698da3afc492c3820b04 /include
parent39dc2b231dae2743bceb6ebb8a3d4792307df12a (diff)
downloadlv2-70e5ebad012d13ff3443b0a5f7fb402ee3212fcb.tar.xz
Avoid narrowing casts through void
Diffstat (limited to 'include')
-rw-r--r--include/lv2/atom/atom.h4
-rw-r--r--include/lv2/atom/util.h2
2 files changed, 3 insertions, 3 deletions
diff --git a/include/lv2/atom/atom.h b/include/lv2/atom/atom.h
index ca607d3..41af21a 100644
--- a/include/lv2/atom/atom.h
+++ b/include/lv2/atom/atom.h
@@ -68,13 +68,13 @@ extern "C" {
@param type The type of the atom, for example LV2_Atom_String.
@param atom A variable-sized atom.
*/
-#define LV2_ATOM_CONTENTS(type, atom) ((void*)((uint8_t*)(atom) + sizeof(type)))
+#define LV2_ATOM_CONTENTS(type, atom) ((void*)((type*)(atom) + 1U))
/**
Const version of LV2_ATOM_CONTENTS.
*/
#define LV2_ATOM_CONTENTS_CONST(type, atom) \
- ((const void*)((const uint8_t*)(atom) + sizeof(type)))
+ ((const void*)((const type*)(atom) + 1U))
/**
Return a pointer to the body of an Atom. The "body" of an atom is the
diff --git a/include/lv2/atom/util.h b/include/lv2/atom/util.h
index a2369da..b8bb295 100644
--- a/include/lv2/atom/util.h
+++ b/include/lv2/atom/util.h
@@ -182,7 +182,7 @@ lv2_atom_sequence_append_event(LV2_Atom_Sequence* seq,
static inline LV2_Atom*
lv2_atom_tuple_begin(const LV2_Atom_Tuple* tup)
{
- return (LV2_Atom*)(LV2_ATOM_BODY(tup));
+ return (LV2_Atom*)tup + 1U;
}
/** Return true iff `i` has reached the end of `body`. */