aboutsummaryrefslogtreecommitdiffstats
path: root/lv2/lv2plug.in/ns/ext/atom/atom-test.c
diff options
context:
space:
mode:
Diffstat (limited to 'lv2/lv2plug.in/ns/ext/atom/atom-test.c')
-rw-r--r--lv2/lv2plug.in/ns/ext/atom/atom-test.c65
1 files changed, 40 insertions, 25 deletions
diff --git a/lv2/lv2plug.in/ns/ext/atom/atom-test.c b/lv2/lv2plug.in/ns/ext/atom/atom-test.c
index 7e90c15..addad81 100644
--- a/lv2/lv2plug.in/ns/ext/atom/atom-test.c
+++ b/lv2/lv2plug.in/ns/ext/atom/atom-test.c
@@ -88,47 +88,53 @@ main()
lv2_atom_forge_set_buffer(&forge, buf, BUF_SIZE);
LV2_Atom_Forge_Frame obj_frame;
- LV2_Atom* obj = (LV2_Atom*)lv2_atom_forge_resource(
- &forge, &obj_frame, 0, eg_Object);
+ LV2_Atom* obj = lv2_atom_forge_deref(
+ &forge, lv2_atom_forge_resource( &forge, &obj_frame, 0, eg_Object));
// eg_one = (Int32)1
lv2_atom_forge_property_head(&forge, eg_one, 0);
- LV2_Atom_Int32* one = lv2_atom_forge_int32(&forge, 1);
+ LV2_Atom_Int32* one = (LV2_Atom_Int32*)lv2_atom_forge_deref(
+ &forge, lv2_atom_forge_int32(&forge, 1));
if (one->body != 1) {
return test_fail("%d != 1\n", one->body);
}
// eg_two = (Int64)2
lv2_atom_forge_property_head(&forge, eg_two, 0);
- LV2_Atom_Int64* two = lv2_atom_forge_int64(&forge, 2);
+ LV2_Atom_Int64* two = (LV2_Atom_Int64*)lv2_atom_forge_deref(
+ &forge, lv2_atom_forge_int64(&forge, 2));
if (two->body != 2) {
return test_fail("%ld != 2\n", two->body);
}
// eg_three = (Float)3.0
lv2_atom_forge_property_head(&forge, eg_three, 0);
- LV2_Atom_Float* three = lv2_atom_forge_float(&forge, 3.0f);
+ LV2_Atom_Float* three = (LV2_Atom_Float*)lv2_atom_forge_deref(
+ &forge, lv2_atom_forge_float(&forge, 3.0f));
if (three->body != 3) {
return test_fail("%f != 3\n", three->body);
}
// eg_four = (Double)4.0
lv2_atom_forge_property_head(&forge, eg_four, 0);
- LV2_Atom_Double* four = lv2_atom_forge_double(&forge, 4.0);
+ LV2_Atom_Double* four = (LV2_Atom_Double*)lv2_atom_forge_deref(
+ &forge, lv2_atom_forge_double(&forge, 4.0));
if (four->body != 4) {
return test_fail("%ld != 4\n", four->body);
}
// eg_true = (Bool)1
lv2_atom_forge_property_head(&forge, eg_true, 0);
- LV2_Atom_Bool* t = lv2_atom_forge_bool(&forge, true);
+ LV2_Atom_Bool* t = (LV2_Atom_Bool*)lv2_atom_forge_deref(
+ &forge, lv2_atom_forge_bool(&forge, true));
if (t->body != 1) {
return test_fail("%ld != 1 (true)\n", t->body);
}
// eg_false = (Bool)0
lv2_atom_forge_property_head(&forge, eg_false, 0);
- LV2_Atom_Bool* f = lv2_atom_forge_bool(&forge, false);
+ LV2_Atom_Bool* f = (LV2_Atom_Bool*)lv2_atom_forge_deref(
+ &forge, lv2_atom_forge_bool(&forge, false));
if (f->body != 0) {
return test_fail("%ld != 0 (false)\n", f->body);
}
@@ -137,7 +143,8 @@ main()
const uint8_t* pstr = (const uint8_t*)"/foo/bar";
const size_t pstr_len = strlen((const char*)pstr);
lv2_atom_forge_property_head(&forge, eg_path, 0);
- LV2_Atom_String* path = lv2_atom_forge_uri(&forge, pstr, pstr_len);
+ LV2_Atom_String* path = (LV2_Atom_String*)lv2_atom_forge_deref(
+ &forge, lv2_atom_forge_uri(&forge, pstr, pstr_len));
uint8_t* pbody = (uint8_t*)LV2_ATOM_BODY(path);
if (strcmp((const char*)pbody, (const char*)pstr)) {
return test_fail("%s != \"%s\"\n",
@@ -148,8 +155,9 @@ main()
const uint8_t* ustr = (const uint8_t*)"http://example.org/value";
const size_t ustr_len = strlen((const char*)ustr);
lv2_atom_forge_property_head(&forge, eg_uri, 0);
- LV2_Atom_String* uri = lv2_atom_forge_uri(&forge, ustr, ustr_len);
- uint8_t* ubody = (uint8_t*)LV2_ATOM_BODY(uri);
+ LV2_Atom_String* uri = (LV2_Atom_String*)lv2_atom_forge_deref(
+ &forge, lv2_atom_forge_uri(&forge, ustr, ustr_len));
+ uint8_t* ubody = (uint8_t*)LV2_ATOM_BODY(uri);
if (strcmp((const char*)ubody, (const char*)ustr)) {
return test_fail("%s != \"%s\"\n",
(const char*)ubody, (const char*)ustr);
@@ -158,15 +166,17 @@ main()
// eg_urid = (URID)"http://example.org/value"
LV2_URID eg_value = urid_map(NULL, "http://example.org/value");
lv2_atom_forge_property_head(&forge, eg_urid, 0);
- LV2_Atom_URID* urid = lv2_atom_forge_urid(&forge, eg_value);
+ LV2_Atom_URID* urid = (LV2_Atom_URID*)lv2_atom_forge_deref(
+ &forge, lv2_atom_forge_urid(&forge, eg_value));
if (urid->body != eg_value) {
return test_fail("%u != %u\n", urid->body, eg_value);
}
// eg_string = (String)"hello"
lv2_atom_forge_property_head(&forge, eg_string, 0);
- LV2_Atom_String* string = lv2_atom_forge_string(
- &forge, (const uint8_t*)"hello", strlen("hello"));
+ LV2_Atom_String* string = (LV2_Atom_String*)lv2_atom_forge_deref(
+ &forge, lv2_atom_forge_string(
+ &forge, (const uint8_t*)"hello", strlen("hello")));
uint8_t* sbody = (uint8_t*)LV2_ATOM_BODY(string);
if (strcmp((const char*)sbody, "hello")) {
return test_fail("%s != \"hello\"\n", (const char*)sbody);
@@ -174,9 +184,10 @@ main()
// eg_literal = (Literal)"hello"@fr
lv2_atom_forge_property_head(&forge, eg_literal, 0);
- LV2_Atom_Literal* literal = lv2_atom_forge_literal(
- &forge, (const uint8_t*)"bonjour", strlen("bonjour"),
- 0, urid_map(NULL, "http://lexvo.org/id/term/fr"));
+ LV2_Atom_Literal* literal = (LV2_Atom_Literal*)lv2_atom_forge_deref(
+ &forge, lv2_atom_forge_literal(
+ &forge, (const uint8_t*)"bonjour", strlen("bonjour"),
+ 0, urid_map(NULL, "http://lexvo.org/id/term/fr")));
uint8_t* lbody = (uint8_t*)LV2_ATOM_CONTENTS(LV2_Atom_Literal, literal);
if (strcmp((const char*)lbody, "bonjour")) {
return test_fail("%s != \"bonjour\"\n", (const char*)lbody);
@@ -185,11 +196,13 @@ main()
// eg_tuple = "foo",true
lv2_atom_forge_property_head(&forge, eg_tuple, 0);
LV2_Atom_Forge_Frame tuple_frame;
- LV2_Atom_Tuple* tuple = (LV2_Atom_Tuple*)lv2_atom_forge_tuple(
- &forge, &tuple_frame);
- LV2_Atom_String* tup0 = lv2_atom_forge_string(
- &forge, (const uint8_t*)"foo", strlen("foo"));
- LV2_Atom_Bool* tup1 = lv2_atom_forge_bool(&forge, true);
+ LV2_Atom_Tuple* tuple = (LV2_Atom_Tuple*)lv2_atom_forge_deref(
+ &forge, lv2_atom_forge_tuple(&forge, &tuple_frame));
+ LV2_Atom_String* tup0 = (LV2_Atom_String*)lv2_atom_forge_deref(
+ &forge, lv2_atom_forge_string(
+ &forge, (const uint8_t*)"foo", strlen("foo")));
+ LV2_Atom_Bool* tup1 = (LV2_Atom_Bool*)lv2_atom_forge_deref(
+ &forge, lv2_atom_forge_bool(&forge, true));
lv2_atom_forge_pop(&forge, &tuple_frame);
LV2_Atom_Tuple_Iter i = lv2_tuple_begin(tuple);
if (lv2_tuple_is_end(tuple, i)) {
@@ -215,8 +228,9 @@ main()
// eg_vector = (Vector<Int32>)1,2,3,4
lv2_atom_forge_property_head(&forge, eg_vector, 0);
int32_t elems[] = { 1, 2, 3, 4 };
- LV2_Atom_Vector* vector = lv2_atom_forge_vector(
- &forge, 4, forge.Int32, sizeof(int32_t), elems);
+ LV2_Atom_Vector* vector = (LV2_Atom_Vector*)lv2_atom_forge_deref(
+ &forge, lv2_atom_forge_vector(
+ &forge, 4, forge.Int32, sizeof(int32_t), elems));;
void* vec_body = LV2_ATOM_CONTENTS(LV2_Atom_Vector, vector);
if (memcmp(elems, vec_body, sizeof(elems))) {
return test_fail("Corrupt vector\n");
@@ -225,7 +239,8 @@ main()
// eg_seq = (Sequence)1, 2
lv2_atom_forge_property_head(&forge, eg_seq, 0);
LV2_Atom_Forge_Frame seq_frame;
- LV2_Atom_Sequence* seq = (LV2_Atom_Sequence*)lv2_atom_forge_sequence_head(&forge, &seq_frame, 0);
+ LV2_Atom_Sequence* seq = (LV2_Atom_Sequence*)lv2_atom_forge_deref(
+ &forge, lv2_atom_forge_sequence_head(&forge, &seq_frame, 0));
lv2_atom_forge_frame_time(&forge, 0);
lv2_atom_forge_int32(&forge, 1);
lv2_atom_forge_frame_time(&forge, 1);