diff options
author | David Robillard <d@drobilla.net> | 2012-02-19 04:43:35 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2012-02-19 04:43:35 +0000 |
commit | 457c9d03595cc4726c3b0ed6daf5c1de312a248f (patch) | |
tree | edf0b3bd54de00229520106d9fb530932a515d7f /src | |
parent | de9d75f051c6dcdf24e1338d558f960b3ec9124b (diff) | |
download | jalv-457c9d03595cc4726c3b0ed6daf5c1de312a248f.tar.gz jalv-457c9d03595cc4726c3b0ed6daf5c1de312a248f.tar.bz2 jalv-457c9d03595cc4726c3b0ed6daf5c1de312a248f.zip |
Shrink atom:Bool serialisation code.
git-svn-id: http://svn.drobilla.net/lad/trunk/jalv@3988 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src')
-rw-r--r-- | src/atom_rdf.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/src/atom_rdf.c b/src/atom_rdf.c index 78fb7e4..ad73eac 100644 --- a/src/atom_rdf.c +++ b/src/atom_rdf.c @@ -25,7 +25,7 @@ #define NS_XSD "http://www.w3.org/2001/XMLSchema#" -#define USTR(str) ((const uint8_t*)str) +#define USTR(str) ((const uint8_t*)(str)) typedef struct { char* buf; @@ -83,13 +83,11 @@ atom_to_rdf(SerdWriter* writer, object = serd_node_new_decimal(*(float*)LV2_ATOM_BODY(atom), 16); datatype = serd_node_from_string(SERD_URI, USTR(NS_XSD "decimal")); } else if (!strcmp(type, LV2_ATOM__Bool)) { + const int32_t val = *(const int32_t*)LV2_ATOM_BODY(atom); new_node = true; datatype = serd_node_from_string(SERD_URI, USTR(NS_XSD "boolean")); - if (*(int32_t*)LV2_ATOM_BODY(atom)) { - object = serd_node_from_string(SERD_LITERAL, USTR("true")); - } else { - object = serd_node_from_string(SERD_LITERAL, USTR("false")); - } + object = serd_node_from_string(SERD_LITERAL, + USTR(val ? "true" : "false")); } else if (!strcmp(type, LV2_ATOM__Blank)) { const LV2_Atom_Object* obj = (const LV2_Atom_Object*)atom; SerdNode idnum = serd_node_new_integer(obj->id); |