From 98d5ce707366a4955bf072389cbc8b1029e1d2a9 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sat, 30 Apr 2011 17:41:21 +0000 Subject: Update for new Serd API git-svn-id: http://svn.drobilla.net/sord/trunk@102 3d64ff67-21c5-427c-a301-fe4f08042e5a --- src/sordi.c | 2 +- src/syntax.c | 24 ++++++++++++------------ 2 files changed, 13 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/sordi.c b/src/sordi.c index 1931b93..78f8690 100644 --- a/src/sordi.c +++ b/src/sordi.c @@ -124,7 +124,7 @@ main(int argc, char** argv) printf("Loaded %zu statements\n", sord_num_nodes(world)); SerdURI base_uri; - if (!serd_uri_parse(input, &base_uri)) { + if (serd_uri_parse(input, &base_uri)) { fprintf(stderr, "Bad input URI <%s>\n", input); return 1; } diff --git a/src/syntax.c b/src/syntax.c index 61c003d..585a642 100644 --- a/src/syntax.c +++ b/src/syntax.c @@ -44,7 +44,7 @@ copy_string(const uint8_t* str, size_t* n_bytes) return ret; } -static bool +static SerdStatus event_base(void* handle, const SerdNode* uri_node) { @@ -53,7 +53,7 @@ event_base(void* handle, return serd_read_state_set_base_uri(state->read_state, uri_node); } -static bool +static SerdStatus event_prefix(void* handle, const SerdNode* name, const SerdNode* uri_node) @@ -94,7 +94,7 @@ sord_node_from_serd_node(ReadState* state, const SerdNode* sn, case SERD_CURIE: { SerdChunk uri_prefix; SerdChunk uri_suffix; - if (!serd_env_expand(state->env, sn, &uri_prefix, &uri_suffix)) { + if (serd_env_expand(state->env, sn, &uri_prefix, &uri_suffix)) { fprintf(stderr, "Failed to expand qname `%s'\n", sn->buf); return NULL; } @@ -140,7 +140,7 @@ sord_node_to_serd_node(const SordNode* node, SerdNode* out) out->n_chars = len - 1; // FIXME: UTF-8 } -static bool +static SerdStatus event_statement(void* handle, const SerdNode* graph, const SerdNode* subject, @@ -174,7 +174,7 @@ event_statement(void* handle, sord_node_free(state->world, o); sord_node_free(state->world, g); - return true; + return SERD_SUCCESS; } static const uint8_t* @@ -238,7 +238,7 @@ sord_read_file_handle(SordModel* model, uint8_t* base_uri_str = copy_string(base_uri_str_in, &base_uri_n_bytes); SerdURI base_uri; - if (!serd_uri_parse(base_uri_str, &base_uri)) { + if (serd_uri_parse(base_uri_str, &base_uri)) { fprintf(stderr, "Invalid base URI <%s>\n", base_uri_str); } @@ -257,14 +257,14 @@ sord_read_file_handle(SordModel* model, serd_reader_set_blank_prefix(state.reader, blank_prefix); } - const bool success = serd_reader_read_file(state.reader, fd, base_uri_str); + const SerdStatus ret = serd_reader_read_file(state.reader, fd, base_uri_str); serd_reader_free(state.reader); serd_read_state_free(state.read_state); serd_env_free(env); free(base_uri_str); - return success; + return (ret == SERD_SUCCESS); } SORD_API @@ -277,7 +277,7 @@ sord_read_string(SordModel* model, uint8_t* base_uri_str = copy_string(base_uri_str_in, &base_uri_n_bytes); SerdURI base_uri; - if (!serd_uri_parse(base_uri_str, &base_uri)) { + if (serd_uri_parse(base_uri_str, &base_uri)) { fprintf(stderr, "Invalid base URI <%s>\n", base_uri_str); } @@ -292,14 +292,14 @@ sord_read_string(SordModel* model, SERD_TURTLE, &state, event_base, event_prefix, event_statement, NULL); - const bool success = serd_reader_read_string(state.reader, str); + const SerdStatus status = serd_reader_read_string(state.reader, str); serd_reader_free(state.reader); serd_read_state_free(state.read_state); serd_env_free(env); free(base_uri_str); - return success; + return (status == SERD_SUCCESS); } SORD_API @@ -379,7 +379,7 @@ make_writer(SerdEnv* env, size_t base_uri_n_bytes = 0; uint8_t* base_uri_str = copy_string(base_uri_str_in, &base_uri_n_bytes); SerdURI base_uri; - if (!serd_uri_parse(base_uri_str, &base_uri)) { + if (serd_uri_parse(base_uri_str, &base_uri)) { fprintf(stderr, "Invalid base URI <%s>\n", base_uri_str); } -- cgit v1.2.1