diff options
author | David Robillard <d@drobilla.net> | 2022-01-02 18:22:35 -0500 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2022-01-28 21:57:29 -0500 |
commit | c02d28085a1f81b542df62fe97a530bb6cbce86d (patch) | |
tree | e528bf4e337656c5a9d5391f4af4b1c080f9da67 /src/nodes.c | |
parent | 77eebec72c0507309ce89f8cdaceff4adfd147cf (diff) | |
download | serd-c02d28085a1f81b542df62fe97a530bb6cbce86d.tar.gz serd-c02d28085a1f81b542df62fe97a530bb6cbce86d.tar.bz2 serd-c02d28085a1f81b542df62fe97a530bb6cbce86d.zip |
Add support for xsd:hexBinary literals
Diffstat (limited to 'src/nodes.c')
-rw-r--r-- | src/nodes.c | 31 |
1 files changed, 28 insertions, 3 deletions
diff --git a/src/nodes.c b/src/nodes.c index b989259d..84c6b696 100644 --- a/src/nodes.c +++ b/src/nodes.c @@ -442,9 +442,9 @@ serd_nodes_integer(SerdNodes* const nodes, const int64_t value) } const SerdNode* -serd_nodes_base64(SerdNodes* const nodes, - const void* const value, - const size_t value_size) +serd_nodes_hex(SerdNodes* const nodes, + const void* const value, + const size_t value_size) { assert(nodes); assert(value); @@ -459,6 +459,31 @@ serd_nodes_base64(SerdNodes* const nodes, like a Real Database(TM) would largely avoid this problem. */ // Determine how much space the node needs + SerdWriteResult r = serd_node_construct_hex(0, NULL, value_size, value); + + // Allocate a new entry to and construct the node into it + NodesEntry* const entry = new_entry(nodes->allocator, r.count); + if (entry) { + r = serd_node_construct_hex(r.count, &entry->node, value_size, value); + + assert(!r.status); + (void)r; + } + + return serd_nodes_manage_entry(nodes, entry); +} + +const SerdNode* +serd_nodes_base64(SerdNodes* const nodes, + const void* const value, + const size_t value_size) +{ + assert(nodes); + assert(value); + + // Same situation as for hex above + + // Determine how much space the node needs SerdWriteResult r = serd_node_construct_base64(0, NULL, value_size, value); // Allocate a new entry to and construct the node into it |