From 457c9d03595cc4726c3b0ed6daf5c1de312a248f Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sun, 19 Feb 2012 04:43:35 +0000 Subject: Shrink atom:Bool serialisation code. git-svn-id: http://svn.drobilla.net/lad/trunk/jalv@3988 a436a847-0d15-0410-975c-d299462d15a1 --- src/atom_rdf.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'src/atom_rdf.c') 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); -- cgit v1.2.1