diff options
-rw-r--r-- | .clang-tidy | 1 | ||||
-rw-r--r-- | include/lv2/atom/atom.h | 4 | ||||
-rw-r--r-- | include/lv2/atom/util.h | 2 | ||||
-rw-r--r-- | plugins/eg-sampler.lv2/uris.h | 2 | ||||
-rw-r--r-- | test/headers/.clang-tidy | 1 | ||||
-rw-r--r-- | test/test_atom.c | 8 |
6 files changed, 8 insertions, 10 deletions
diff --git a/.clang-tidy b/.clang-tidy index 5279051..4033a55 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -7,7 +7,6 @@ Checks: > -*-magic-numbers, -altera-*, -bugprone-assignment-in-if-condition, - -bugprone-casting-through-void, -bugprone-easily-swappable-parameters, -bugprone-macro-parentheses, -clang-diagnostic-unused-function, 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`. */ diff --git a/plugins/eg-sampler.lv2/uris.h b/plugins/eg-sampler.lv2/uris.h index f934390..3d3ac10 100644 --- a/plugins/eg-sampler.lv2/uris.h +++ b/plugins/eg-sampler.lv2/uris.h @@ -164,7 +164,7 @@ read_set_file(const SamplerURIs* uris, const LV2_Atom_Object* obj) return NULL; } - return (const char*)LV2_ATOM_BODY_CONST(value); + return (const char*)&value[1]; } #endif /* SAMPLER_URIS_H */ diff --git a/test/headers/.clang-tidy b/test/headers/.clang-tidy index 26d6f6f..bf971cc 100644 --- a/test/headers/.clang-tidy +++ b/test/headers/.clang-tidy @@ -7,7 +7,6 @@ Checks: > -*-magic-numbers, -altera-*, -bugprone-assignment-in-if-condition, - -bugprone-casting-through-void, -bugprone-easily-swappable-parameters, -bugprone-macro-parentheses, -llvmlibc-restrict-system-libc-headers, diff --git a/test/test_atom.c b/test/test_atom.c index beac05c..421063e 100644 --- a/test/test_atom.c +++ b/test/test_atom.c @@ -101,7 +101,7 @@ main(void) lv2_atom_forge_key(&forge, eg_path); LV2_Atom_String* path = (LV2_Atom_String*)lv2_atom_forge_deref( &forge, lv2_atom_forge_uri(&forge, pstr, pstr_len)); - char* pbody = (char*)LV2_ATOM_BODY(path); + char* pbody = (char*)&path[1]; if (!!strcmp(pbody, pstr)) { return test_fail("%s != \"%s\"\n", pbody, pstr); } @@ -112,7 +112,7 @@ main(void) lv2_atom_forge_key(&forge, eg_uri); LV2_Atom_String* uri = (LV2_Atom_String*)lv2_atom_forge_deref( &forge, lv2_atom_forge_uri(&forge, ustr, ustr_len)); - char* ubody = (char*)LV2_ATOM_BODY(uri); + char* ubody = (char*)&uri[1]; if (!!strcmp(ubody, ustr)) { return test_fail("%s != \"%s\"\n", ubody, ustr); } @@ -130,7 +130,7 @@ main(void) lv2_atom_forge_key(&forge, eg_string); LV2_Atom_String* string = (LV2_Atom_String*)lv2_atom_forge_deref( &forge, lv2_atom_forge_string(&forge, "hello", strlen("hello"))); - char* sbody = (char*)LV2_ATOM_BODY(string); + char* sbody = (char*)&string[1]; if (!!strcmp(sbody, "hello")) { return test_fail("%s != \"hello\"\n", sbody); } @@ -144,7 +144,7 @@ main(void) strlen("bonjour"), 0, urid_map(NULL, "http://lexvo.org/id/term/fr"))); - char* lbody = (char*)LV2_ATOM_CONTENTS(LV2_Atom_Literal, literal); + char* lbody = (char*)&literal[1]; if (!!strcmp(lbody, "bonjour")) { return test_fail("%s != \"bonjour\"\n", lbody); } |