summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/sratom.c6
-rw-r--r--tests/sratom_test.c15
2 files changed, 14 insertions, 7 deletions
diff --git a/src/sratom.c b/src/sratom.c
index e3238e1..c70eee8 100644
--- a/src/sratom.c
+++ b/src/sratom.c
@@ -168,7 +168,7 @@ sratom_write(Sratom* sratom,
SerdNode language = SERD_NODE_NULL;
bool new_node = false;
if (type_urid == 0 && size == 0) {
- object = serd_node_from_string(SERD_BLANK, USTR("null"));
+ object = serd_node_from_string(SERD_URI, USTR(NS_RDF "nil"));
} else if (type_urid == sratom->forge.String) {
object = serd_node_from_string(SERD_LITERAL, (const uint8_t*)body);
} else if (type_urid == sratom->forge.Literal) {
@@ -485,7 +485,9 @@ read_node(Sratom* sratom,
lv2_atom_forge_string(forge, (const uint8_t*)str, len);
}
} else if (sord_node_get_type(node) == SORD_URI) {
- if (serd_uri_string_has_scheme((const uint8_t*)str)) {
+ if (!strcmp(str, (const char*)NS_RDF "nil")) {
+ lv2_atom_forge_atom(forge, 0, 0);
+ } else if (serd_uri_string_has_scheme((const uint8_t*)str)) {
lv2_atom_forge_urid(forge, map->map(map->handle, str));
} else {
lv2_atom_forge_uri(forge, (const uint8_t*)str, len);
diff --git a/tests/sratom_test.c b/tests/sratom_test.c
index db7be64..4789ce2 100644
--- a/tests/sratom_test.c
+++ b/tests/sratom_test.c
@@ -97,11 +97,12 @@ main()
LV2_URID eg_string = urid_map(NULL, "http://example.org/j-string");
LV2_URID eg_langlit = urid_map(NULL, "http://example.org/k-langlit");
LV2_URID eg_typelit = urid_map(NULL, "http://example.org/l-typelit");
- LV2_URID eg_blob = urid_map(NULL, "http://example.org/m-blob");
- LV2_URID eg_blank = urid_map(NULL, "http://example.org/n-blank");
- LV2_URID eg_tuple = urid_map(NULL, "http://example.org/o-tuple");
- LV2_URID eg_vector = urid_map(NULL, "http://example.org/p-vector");
- LV2_URID eg_seq = urid_map(NULL, "http://example.org/q-seq");
+ LV2_URID eg_null = urid_map(NULL, "http://example.org/m-null");
+ LV2_URID eg_blob = urid_map(NULL, "http://example.org/o-blob");
+ LV2_URID eg_blank = urid_map(NULL, "http://example.org/p-blank");
+ LV2_URID eg_tuple = urid_map(NULL, "http://example.org/q-tuple");
+ LV2_URID eg_vector = urid_map(NULL, "http://example.org/r-vector");
+ LV2_URID eg_seq = urid_map(NULL, "http://example.org/s-seq");
uint8_t buf[1024];
lv2_atom_forge_set_buffer(&forge, buf, sizeof(buf));
@@ -167,6 +168,10 @@ main()
&forge, (const uint8_t*)"value", strlen("value"),
urid_map(NULL, "http://example.org/Type"), 0);
+ // eg_null = null
+ lv2_atom_forge_property_head(&forge, eg_null, 0);
+ lv2_atom_forge_atom(&forge, 0, 0);
+
// eg_blob = 0xDEADBEEF
uint32_t blob_type = map.map(map.handle, "http://example.org/Blob");
uint8_t blob_buf[] = { 0xDE, 0xAD, 0xBE, 0xEF };